0
What's the issue with this?
It is not working... I don't get it... Help in comments...
7 ответов
+ 15
Your program has to be inside main(), because main() is where your program begins to run. Code Playground loads the default code template, and you have to place your statements inside main() instead of below it.
#include <iostream>
using namespace std;
int main()
{
string name;
cout << "Hello. I am C++. Who are you?\n";
cin >> name;
cout << "Hello " << name;
return 0;
}
Few more points to take note:
• Differentiate between << and >> operators
- cout << something;
- cin >> something;
• Use correct datatypes for variable declaration
- int for integers
- char for single characters
- string for a collection of chars
• Enforce indentations wherever needed
+ 7
#include <iostream>
using namespace std;
int main()
{
return 0;
}
{
cout>>"Hello. I am C++. Who are you?\n";
int name;
cin>>name;
cout>>"Hello,";
cout>>name;
}
His code is like this....Ummm....I can't explain the error -_- *Headache*
+ 4
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello. I am C++. Who are you?";
char name;
cin>>name;
cout<<"Hello," <<name;
}
how abt this?
+ 3
int name??
+ 1
if the code is what is in the tags, there is a missing } at the end. but i cannot see how this can be related to loops. there is none in this program.