error: expected ';' before 'Gname'

I keep on getting this error: expected ';' before 'Gname'|
but before int main()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  #include "main.h"
#include <iostream>


int main()
{
    int Gname;

    std::cout << "Guess my name by shiny21" << std::endl;
    std::cout << "NOTE: My name is not shiny21!!!" << std::endl;

    std::cout << "Enter my name:" << std::endl;
    std::cin Gname;

}
Look at line 13. You need the >> operator before Gname otherwise it makes no sense to declare Gname as a type of std::cin when std::cin is a variable name
Last edited on
Thanks!
Topic archived. No new replies allowed.