Beginners - July 2018 (Page 4)

Help debugging classes.
 
Hello. When i compile the following code it runs just fine. #include <iostream> #include <string> using namespace std; class MyClass { publ...
[6 replies] Last: using std::string; is less bad than using namespace std; in a head... (by MikeyBoy)
Homework help
 
Hi ,so I started on this homework but I'm having trouble finishing it and I was wondering if I could get some help. heres the code that I have right now: ...
[2 replies] Last: Hello gentrybryant, At first check the variable "ID" is undefined in ... (by Handy Andy)
by clonxy
2d array in classes
 
Can someone please look at my code? My professor gave us main.cpp and expects us to be able to code the class files. I tried coding it, but it's not working. I ...
[2 replies] Last: return (rows,cols); This is wrong. (by Repeater)
Using Sentinel Values In A While Loop
 
I need help with counting the months in my code. I always end up with 1 more month than i need after the program compiles. The assignment i was given is to use ...
[3 replies] Last: #include <iostream> int main() { int num_months = 0 ; long l... (by JLBorges)
Help with constructor.
 
Hi, can these two codes be used interchangeably? If not, what is the advantage of one over the other? #include <iostream> using namespace std; cl...
[4 replies] Last: also note that the constructor (example 1) reused set name, this is go... (by jonnin)
Classes and arrays
 
Hi. I am trying to write a database on c++ to practice classes. I've created a class called PersonalData and the name is Person. Now, since the program is conne...
[2 replies] Last: standard c++ does not allow a variable for array size because it is su... (by jonnin)
Debugging - What is it and how to do it? Basics?
 
Hey Everyone i've been pointed out several times that i should learn how to debug a program. The thing is i don't know the first thing about it. So could anyone...
[2 replies] Last: Beyond the debugger, it becomes an art that you just refine by practic... (by jonnin)
by t009
Can't find documentation of ": " in for(... : ...)
 
This is my first encounter with it //points is a vector for(int p: points) ost<<....<<endl;
[2 replies] Last: range-based for loop; lots of languages have it https://en.cppreferen... (by icy1)
by Gakus
Error when running my code
 
Hello folks, I'm very new to C++. My problem is that when I run my coded below on Xcode, I get a following error. libc++abi.dylib: terminating with uncaught ex...
[5 replies] Last: Please DON'T delete your code after you've got the answer to your ques... (by MikeyBoy)
by b3y0nd
Creating Arrays with user inputed index and elements
 
First time running an array with user input. want user to define the maximum number of array elements within 1 - 50. #include <iostream> using namespace st...
[1 reply] : 1) In C and C++, function arguments are passed by value. The num1 ... (by MikeyBoy)
C extern function returns incorrectly
 
Hi, Previously on my programming project, The returnValue in Init.cpp is about 4.1. When it is returned to the main function, it is 0. Why is my returnValue...
[3 replies] Last: Please DON'T delete your code after you've got the answer to your ques... (by MikeyBoy)
Confusion in Pointers (1,2)
 
Code 1 works perfectly fine, then why not code 2.As, i can see *p+1 is not a valid operation in code 2, but why?? what is the difference between p =&t and *p ...
[21 replies] Last: Also, on g++, make sure you compile with warnings enabled. For example... (by Ganado)
sqrt issues
 
Hello all, I am working on teaching myself to code and have hit a wall. The top code gives me the sqrt I need (roughly 9.9) to get out of the bottom code. The b...
[5 replies] Last: The amount of time I spent on that is now embarrassing, considering th... (by Triad0226)
Getting WA although the question statement seems pretty basic
 
Write your question here. Jitendra has won a lottery of K rupees. He wants to utilize this money optimally. He wants to travel different cities in consecutive...
[11 replies] Last: @iamdad3 i have looked all the condition still getting wrong answer ,... (by shubhum)
Iterator pointer question
 
I'm so confused right now. Why does my iterator (*it) = _NODE[ListPOS crashes. Can someone explain what it does and why it crashes? Also, _NODE is a vect...
[1 reply] : There are several possibilities. it could be uninitialized, invali... (by Peter87)
Single logical operator / SDL2 Question (No need to be familiar with SDL2)
 
Hi!.. *No need to be familiar with SDL2 but it would help to clarify some stuff. I was going through an SDL2 guide and found a line of code where you can us...
[1 reply] : | is bitwise OR. Consider the following operation (binary (decimal)): ... (by helios)
T table of n rows and m columns
 
I'm supposed to create a program that allows adding the number of positive elements and the negatives of a T table of n rows and m columns. I managed to do f...
[4 replies] Last: "T" is usually type, like int, double, string, any class, etc. If you... (by icy1)
by Houd
Weird Class/Function File Interaction
 
I have a weird problem that only appears when I split the program into multiple files and pass by reference. Let's say I have 4 files: main.cpp: #pragma once...
[15 replies] Last: VS is dumb, I had too many dumb things happen that does not happen on ... (by Houd)
major or egual problem
 
hi guys, can't get why in the last function("QUICKSORT", that is a way to order a vector using the previous function "partitionsort") if in the condition for th...
[4 replies] Last: do you really code like this? (by seungyeon)
okay, so we have solution. Why does it work?
 
Here's my favorite solution to the pinned "Console closing down" issue. It uses what should be an infinite loop, but manages to only print each line once as opp...
[2 replies] Last: The pinned "Console closing down" issue is completely different, and, ... (by icy1)
July 2018 Pages: 123456... 17
  Archived months: [jun2018] [aug2018]

This is an archived page. To post a new message, go to the current page.