FAQ: Variables - Chaining

it also happened with but its not the fault in site on anyother its just a internet network issue try with different better connectivity internet

you forget to place “;” (terminator) after score

I can’t move on to the next step because it said that I didn’t use chaining which I did actually? It this a bug?

#include <iostream>

int main() {
  
  int score = 0;
  
  // Output
  std:: cout << "Player score: " << score << "\n";
}

have you tried compiling the program to see if there are any compiler errors?


I think I did actually.

Did you solve the problem?


I am literally so confused… what am I doing wrong? what is not causing this to work?
I even type the exact same thing as in the hint, and it still says its wrong?
but i can copy and paste the text from the hint and its correct?? please help…

exact match include case sensitivity :wink:

1 Like

wait it was capital P ?? and you actually have to use capitals ??
man … I can’t believe I didn’t even see that… i spent so long trying to figure out what I was doing wrong …
literally like 30 minutes … all for a capital P ???

That seems to be the case, yes.

#include

int main() {

int score = 0;

// Output
std::cout << "Player score: " << score << “\n”;

}

P capital of the Player!!! :smiley:

wiki-bot, I have a little problem. I had copied and pasted the example “I am 28 years old” chaining, not realizing that I should have followed the instructions to print out “Player score: 0” instead. I tried doing “g++ game.cpp” to compile it, but when I did “./a.out” to print it out, it printed out “I am 28 years old” instead. Can you give a suggestion?

Hello, @py1214614983, and welcome to the forums.

Make sure you click Run after making any changes to your code. Clicking Run in the exercises where you have to compile and run your code by typing commands in the console, is akin to Saving your code. The button really should say Save instead. If you don’t click it, you are just re-compiling whatever code was saved last.

Thank you midlindner. I clicked Run, ran a.out and nothing happened. But that is because I did not use G++. So I used it, and it WORKED!!!

1 Like

Yes. You have to Save, Compile and then Execute/Run your code each time you change anything. :wink:

#include

int main() {

int score = 0;

// Output
std::cout << “Players score: " << score << " \n”;

}

why is this being marked wrong? i run it myself and it outputs zero.

1 Like

same with me, it’s exactly the solution…