Hello, Ive started to programming a few days ago, I'm totally new never done it before.
Ive read through the internet for some knowledge about programming.
I used the program code blocks to program yesterday but I got some errors in it so I uninstalled it, it wasnt really errors but sometimes it did work to use for example "#include <iostream>" and sometimes when I did it and tryed to compile it said I didnt have iostream or something like that.
Today I watched a tutorial about programming I did exactly as him but I still got these errors, I dont know why.
Currently I'm using Dev-c++ version 4.9.9.2
Here's the errors.
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c eeeee.cpp -o eeeee.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"
eeeee.cpp: In function `int main()':
eeeee.cpp:43: error: expected `)' before "x"
eeeee.cpp:48: error: expected `)' before "X"
eeeee.cpp:68: error: expected `while' at end of input
eeeee.cpp:68: error: expected `(' at end of input
eeeee.cpp:68: error: expected primary-expression at end of input
eeeee.cpp:68: error: expected `)' at end of input
eeeee.cpp:68: error: expected `;' at end of input
eeeee.cpp:68: error: expected `}' at end of input
make.exe: *** [eeeee.o] Error 1
Execution terminated
And here is the code i used:
#include<iostream>
using namespace std;
int main(void)
{
system("TITLE Calculator");
system("COLOR 2");
char cChar;
double dfirstnumber;
double dsecondnumber;
char cDoagain;
do
{
system("CLS");
cout << "Please enter the first number that you would like to use" << endl;
cin >> dfirstnumber
;cout << "Please enter the operation you would like to complete" << " (+,-,* or /)" << endl;
cin >> cChar;
cout << "Please enter the second number you would like to use" << endl;
switch (cChar)
{
case '+':
cout << "The answer is: " << dfirstnumber << " + " <<
dsecondnumber << " = " << (dfirstnumber + dsecondnumber)
<< endl;
break;
case '-':
cout << "The answer is: " << dfirstnumber << " - " <<
dsecondnumber << " = " << (dfirstnumber - dsecondnumber)
<< endl;
break;
case '*':
cout << "The answer is: " << dfirstnumber << " * " <<
dsecondnumber << " = " << (dfirstnumber * dsecondnumber)
<< endl;
break;
case 'x':
cout << "The answer is: " << dfirstnumber << " x " <<
dsecondnumber << " = " << (dfirstnumber x dsecondnumber)
<< endl;
break;
case 'X':
cout << "The answer is: " << dfirstnumber << " X " <<
dsecondnumber << " = " << (dfirstnumber X dsecondnumber) << endl;
break;
case '/':
if(dsecondnumber == 0) {
cout << "That is an invalid operation" << endl;
}else{
cout << "The answer is: " << dfirstnumber << " / " <<
dsecondnumber << " = " << (dfirstnumber / dsecondnumber)
<< endl;
}
break;
default:
cout << "That is an invalid operation" << endl;
break;
cout << "Would you like to start again (y or no)" << endl;
cin >>cDoagain;
}while (cDoagain == 'Y' || cDoagain == 'y');
system("PAUSE");
return 0;
}
Thanks.