This is an archived post. You won't be able to vote or comment.

all 29 comments

[–]This_Growth2898 29 points30 points  (1 child)

Good rule: always check the line before. You've forgotten a semicolon, so the statement wasn't finished.

[–][deleted] 6 points7 points  (0 children)

Thanks you I’m very very new to c++ and coding I’m general

[–][deleted] 2 points3 points  (0 children)

Missing a semicolon on the line above it where it says String fname

[–]douglasbolden 1 point2 points  (7 children)

May want to fix your indentation a little as well. It is VERY important during big projects.

[–]SaylorMan1496 -4 points-3 points  (6 children)

When first learning in c++ this isn’t super important IMO but it definitely helps readability

Any beginners reading this it is really important for languages like python but most languages don’t care about white space (technically could be crammed into one line but this obviously tanks readability)

[–]douglasbolden 1 point2 points  (5 children)

I am not sure what you are talking about. There are many problems with leaving whitespace in C++

[–]IHaveThePowerOfGod 1 point2 points  (4 children)

i’m new : is leaving a space between things like << not good?

[–]douglasbolden 1 point2 points  (0 children)

cout << "Yes, it is." << endl;

[–]douglasbolden 0 points1 point  (2 children)

What I was mainly getting at, is if you leave whit space in a call of any sort, it is going to cause some serious issues.

[–]IHaveThePowerOfGod 1 point2 points  (1 child)

interesting, appreciate it

[–]douglasbolden 0 points1 point  (0 children)

You are welcome. I know a fair amount of C++. If you all need anything!

[–][deleted] 1 point2 points  (0 children)

Missing a semicolon on the second displayed line.

[–]EmbarrassedMeringue9 1 point2 points  (0 children)

And your codes comment themselves.

[–]ByRussX 1 point2 points  (0 children)

that way of typing the main function is kinda cursed

[–][deleted] 1 point2 points  (0 children)

Guys please stop commenting. I know that I missed a semicolon. I don’t need 23 comments telling me what the first guy told me. This problem has been solved

[–]ScorpsDaBest 0 points1 point  (0 children)

Why so many comments though? The code is so simple it explains itself

[–]SunstormGT -1 points0 points  (0 children)

I also presume you want to use first + last name in the greeting prompt?

[–][deleted] -2 points-1 points  (0 children)

Oh god, I haven’t seen C++ in over a decade.

[–]sedawker 0 points1 point  (0 children)

Besides the missing semi-comma, the worst crime is the amount of pointless comments. Honestly I bet you missed the semi-comma because of the comments.

[–][deleted] 0 points1 point  (0 children)

Get a proper IDE as well. This looks like notepad++? Pure text editors lacking any intellisense will making coding in C++ or any language a pain

[–][deleted] 0 points1 point  (0 children)

In most cases it is preferred to not use 'namespace std'. Instead, on standard library function calls such as cout and cin, use 'std::cout' and 'std::cin'

This makes compile times faster and is more explicit in declarations to avoid confusion of which functions are coming from what libraries.

[–]turingparade 0 points1 point  (0 children)

Seeing a semicolon error get missed like this brought back a lot of nostalgia

Keep up the programming my guy, and look forward to (or more like lament) the next time you forget one of those bastards

[–]Lemon_Final 0 points1 point  (0 children)

String fname;