Hello there, i have recently started messing around with some C++ tutorials and currently using Dev-C++ to complete every action that i need to try, please note that its my very first experience at coding and im having a hard time starting off :( , i have joined this forum hoping that i will find people that wont mind helping me out a little, from what i read from my tutorials, i've understood some basic commands, and i just thought that i'd try this out, (which turns out not to work) , i was hoping you guys could tell me, If my code is absolutely wrong, or maybe it just has a mistake or two, please understand that i need this kind of method for my improvement, as simply reading tutorials isnt helping me :(
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#include <iostream>
using namespace std;
int main()
{
int x,y
cout << "Write a number:" << endl;
cin >> x ;
cout <<"Write another number" << endl;
cin >> y ;
cout <<"Wanna know the summ of those two numbers?" << endl;
if
{
cin >> yes
then
cout << x + y << endl;
else
cin >> no
cout <<" Ok. " << endl;
}
cout <<"Press the enter key to exit";
cin.ignore(cin.rdbuf()->in_avail() + 1);
return 0;
}
|
Errors that im getting while trying to compile:
9 D:\PROGRAMMING SECTION\GameOver!\GameOver!.cpp expected init-declarator before "cout"
9 D:\PROGRAMMING SECTION\GameOver!\GameOver!.cpp expected `,' or `;' before "cout"
12 D:\PROGRAMMING SECTION\GameOver!\GameOver!.cpp `y' undeclared (first use this function)
15 D:\PROGRAMMING SECTION\GameOver!\GameOver!.cpp expected `(' before '{' token
I kept trying to figure out how or what to do to fix the errors, but ... i guess you can imagine where im standing :( , right in middle of a dense fog without knowing which way im headed. Enlighten me please :(