Hey alle...
Jeg er ved at lave en lommeregner i Dev-C++, men jeg for nogen errors..
Det er i
linje 5 expected `,' or `...' before '{' token
Linje 59 expected `)' at end of input
Linje 59 expected `,' or `;' at end of input
Linje 59 expected init-declarator at end of input
#include<iostream>
using namespace std;
int main(void
{
system("TITLE Lommeregner");
system("COLOR 2");
char cChar;
double dfirstnumber;
double dsecondnumber;
char cDoagain;
do
{
system("CLS")
cout << "Sæt det første nummer ind" << endl;
cin >> dfirstnumber;
cout << " Sæt ind hvad du vil gøre"
<< " (+,-,* eller /)" << endl;
cin >> cChar;
cout << "sæt det andet nummer ind"
<< endl;
cin >> dsecondnumber;
switch (cChar)
{
case '+':
cout << "Svaret er: " << dfirstnumber << " + " << dsecondnumber << " = " << (dfristnumber + desecondnumber) << endl;
break;
case '-':
cout << "Svaret er: " << dfirstnumber << " - " << dsecondnumber << " = " << (dfristnumber - desecondnumber) << endl;
break;
case '*':
cout << "Svaret er: " << dfirstnumber << " * " << dsecondnumber << " = " << (dfristnumber * desecondnumber) << endl;
break;
case 'x':
cout << "Svaret er: " << dfirstnumber << " x " << dsecondnumber << " = " << (dfristnumber * desecondnumber) << endl;
break;
case 'X':
cout << "Svaret er: " << dfirstnumber << " X " << dsecondnumber << " = " << (dfristnumber * desecondnumber) << endl;
break;
case '/':
if(dsecondnumber == '0'){
cout << "Kan ikke regnes ud" << endl;
}else{
cout << "Svaret er: " << dfirstnumber << " / " << dsecondnumber << " = " << (dfristnumber / desecondnumber) << endl;
break;
default:
cout << "Kan ikke regnes ud" << endl;
break;
}
cout << "Vil du regne noget nyt? (j eller n)" << endl;
cin >> cDoagain;
}while (cDoagain == 'J' || cDoagain == 'j');
system("PAUSE");
return 0;
}