Hello. Could you tell me what I did wrong here please? Don't mind the 2 digit grade stuff I'll do it later.
>>57527764
When you enter the first first mark, think about what you are actually typing: a 6, a 9, AND a \n (hitting enter). cin will read the numerical part (69) but the non-numerical part is left in the buffer. So your next getline immediately reads a \n and stops, returning an empty string.
cin.ignore() will ignore a character in the input buffer.
you used c++
>>57527993
what would you recommend then?
>>57528366
OP here fuck that shit nigga. We need to do this in C but its fucking retarded. Kill yourself nigga
>>57528547
m8, just use scanf() instead of cin
and printf() instead of cout and it's the same thing
if you are so retarded why don't you try python?
>>57527979
>cin.ignore()
Thanks that actually worked. I replaced the second cin with cin.ignore. I'll look more into why it worked. Thank you
>>57528604
I don't like that shit. You have to declare value types and have to use & to allocate shit fuck it I nearly puked at the first CP lesson.
You're doing a lot wrong desu family, but everyone does at the start. Looks like someone else helped you out, but if I can give some style advice:
>give variables meaningful names, e.g. student1Score, student2Score, nameQuestion, scoreQuestion, student1Name, student2Name
>even better, use arrays and a loop if you know how, though it looks like the course you're taking may not have covered those concepts yet
>in general, avoid multiple statements on one line (i.e. start a new line after each semicolon)
>you can put a '\n' character at the end of a string instead of doing it as a single character, e.g. "Student 1:\n"
>>57528639
Just read & as "address of" and your good to go.
>>57528806 again
Actually sorry I don't know why I said you're doing a lot wrong, that was mean. Hope you find the advice helpful though.
>>57528806
>>57528834
No worries. Thanks for your consideration. Yes i know bout loops and arrays from highschool but it seemed easier for me to do it like this. I'm not at Computer Science so we don't do intensive programming like learning 4 different languages at the same time or whatever some of my friends do. I went for electrical engineering because I like it more than programming. I don't want to code for the rest of my life, I feel that even if I gave my best at programming there's always some code monkey 12yr old that would outrun me by miles and the fact that there's 12 billion languages which are constantly upgrading or whatever makes it even shittier for me.
Sorry for the blogpost. Thank you all for the help and sorry for the retarded nignog replies.
>>57527764
You can replace '\n' with "endl".
Using system("pause") is a very bad practice since it doesn't work outside Windows and MS-DOS systems.
You can replace that with a prompt that says "Press ENTER to continue..." and cin.ignore(1,'\n');
>>57529328
Dully noted
For starters, system("pause") is always wrong. Remove it from your code.
>>57529601
it's nice if you don't want to debug, but it gets annoying when you have to press enter everytimes. Just add a debug point