Hi!
I just started learning C++ as my first programming language.
I started by writing my first code, but I ran into an issue. I'll leave the entire code below:
#include <iostream>
using namespace std;
int main()
{
// This part of code is for the input.
cout << "x + 2 = 4. how much is x?" << endl;
int x = 0;
cin >> x;
cout << x + 2 << endl;
int rez = 0
;cout << "did you answer honestly?" << endl;
cin >> rez;
if (rez = 1) {
cout << "you have 200 IQ!";
} else {
cout << "sorry! you will need to learn math!";
}
// Outputs the result.
#include <iostream>
usingnamespace std;
int main()
{
cout << "x + 2 = 4. how much is x? ";
int x {};
cin >> x;
cout << x + 2 << '\n';
int rez {};
cout << "Did you answer honestly (1 for yes, 0 for no)? ";
cin >> rez;
if (rez == 1)
cout << "You have 200 IQ!\n";
else
cout << "Sorry! you will need to learn math!\n";
}