2019-01-09 05:48:26

I was wondering if someone would mind taking a look at this class I'm attempting to make with C++? Something weird is happening, and I'm really not sure why.
We're being forced to use code blocks, so I'm having a huge amount of trouble trying to figure out where the error actually, is.
I ask these kinds of questions a lot and it never really gets places, so I understand if people are bored. tongue

Generic signature

Thumbs up +1

2019-01-09 07:07:12

OK, here is my analysis:
1. Line 27: no need for parentheses in cout. Cout's syntax is just:
cout << text << text << text <<...;
2. Line 35: Remove the parenthesis at the end of that line.
3. Line 43: See 1.
4. Line 51: You've got a / here. Remove it, unless you mean a comment. And same thing as 1.
5. Line 59, 68, 70: see 1.
6. Lines 69, 71: change getLine to getline.
7. You never finish main(). You need a final }.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.

Thumbs up +1

2019-01-10 06:30:45

Thanks for that! I also realized that I can't actually check strings against null in c++ for some reason, so that's another thing.

Generic signature

Thumbs up

2019-01-10 10:02:55

if you are using char* or const char*, you can. but about std::string, you can't
in short, you can check pointers.
you can check std::string* since that is a pointer

bitcoin address: 1LyQ3hziMC2DTnCtgM3V1zfuZ73P3CYT9P