#include <windows.h>
# include <cmath>
using namespace std;
int main()
{
HANDLE hOut;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hOut,
FOREGROUND_GREEN);
using namespace std;
int tal1, tal2, tal3;
char lol;
int val;
cout << " vx84lj siffra; " << "
" << " 1 fx94r minirx84knare och 2 fx94r exit " << endl << endl << endl;
cin >> val;
if (val == 1);
{
cout << " Var vx84nligen att mata in tvx86 tal som du vill rx84kna ut " << endl << endl;
cin >> tal1 >> lol >> tal2;
cout << "
";
switch(lol)
{
case '+':
tal3 = tal1 + tal2;
cout << tal1 << " " << lol << " " << tal2 << " x84r lika med " << tal3;
break;
case '-':
tal3 = tal1 - tal2;
cout << tal1 << " " << lol << " " << tal2 << " x84r lika med " << tal3;
break;
case '/':
tal3 = tal1 / tal2;
cout << tal1 << " " << lol << " " << tal2 << " x84r lika med " << tal3;
break;
case '*':
tal3 = tal1 * tal2;
cout << tal1 << " " << lol << " " << tal2 << " x84r lika med " << tal3;
break;
default:
cout << " Felaktig commando!";
}
}
else if (val == 2);
{
double value;
cin >> value;
double round = floor(value + 0.5);
cout << round << endl;
}
cout << "
";
system("pause");
return 0;
}
felet är vid if else (val == 2);
fel:
expected primary-expression before "else"
expected `;' before "else"
tack för svaren och hoppas att ni kan läsa koden :P
lol