I'm new in C++, and I try to print 'Hello world'.
#include <iostream>
using namespace std;
int main() {
cout << 'Hello world!';
return 0;
}
But in result I got '1919706145'. What I'm doing wrong?
I'm new in C++, and I try to print 'Hello world'.
#include <iostream>
using namespace std;
int main() {
cout << 'Hello world!';
return 0;
}
But in result I got '1919706145'. What I'm doing wrong?
Strings are represented by ", not '
#include <iostream>
using namespace std;
int main() {
cout << "Hello world!"; // Use " not '
return 0;
}
You should use:
cout << "Hello World!" << endl;
Use ' ' for characters not strings. Characters are single alphabets like 'h', 'i', etc while string is "hi".
Try doing :
cout << "Hello world!"; // <---------Double Quotes
Strings use double quotes. Single quotes are for single characters.