I am a beginner in programming with C++.
I wrote a program, which must return 'number * 2':
#include <iostream>
int main()
{
std::cout << 'Write a number: ';
int x{};
std::cin >> x;
int y{ x * 2 };
std::cout << 'Number * 2 = ' << y << '.';
return 0;
}
When I hit F11 (start program), it always returns a long number.
I work in Dev C++.
Errors, that happened:
What's going on here, and how can I solve it?
Single quotes are for single characters. Double quotes are for strings. You should turn on your compiler warnings.