l2oBiN_Ho0D
September 18th, 2002, 07:03 AM
Hi guys, ive been asked to create a simple calculator in c++ and this is what i came up with using microsoft visual c++
//Solution Algorythmns
#include <iostream.h>
int main
;SetCounters();ProcessNumbers();DisplayOutput(){
//start of "SetCounters" module.
int SetCounters();
int MoreNumbers;
MoreNumbers = 0;
int TotalCounter;
TotalCounter = 0;
// end of "SetCounters" module.
//start of "Input" module.
int Input();
int Number1;
int Action;
int Number2;
cout<<"Please insert your first number";
cin>>Number1;
cout<<"please insert what you want to do, +,-,* or /";
cin>>Action;
cout<<"please insert your second number";
cin>>Number2;
//end of "Input" module
//start of "ProcessNumbers" module.
int ProcessNumbers();
while (MoreNumbers==0){
Input();
cout<<"The calculation is"<<Number1+Action+Number2<<"\n";
TotalCounter = Number1+Action+Number2;
cout<<"are there more numbers to be calculated? Y=0, N=1";
cin>>MoreNumbers;
}
//end of "ProcessNumbers" module.
int DisplayOutput();
cout<<TotalCounter;
//end of "ProcessNumbers" module
return 0;
}
when i compiled it said everything is ok (no errors or warnings), but when i clicked build i got 3 errors, i got no idea where i stuffed up..
The errors are:
Linking...
Try.obj : error LNK2001: unresolved external symbol "int __cdecl Input(void)" (?Input@@YAHXZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Try.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Can anyone see the problem?? also, i kno there must be some logic errors there as this is the first time im doing something like this,in particular the line
" TotalCounter = Number1+Action+Number2;" doesent seem right to me, does anyone know if this is right? and if its not, how can i go around this problem?
thank you to anyone who goes out of their way to help me...
:(
//Solution Algorythmns
#include <iostream.h>
int main
;SetCounters();ProcessNumbers();DisplayOutput(){
//start of "SetCounters" module.
int SetCounters();
int MoreNumbers;
MoreNumbers = 0;
int TotalCounter;
TotalCounter = 0;
// end of "SetCounters" module.
//start of "Input" module.
int Input();
int Number1;
int Action;
int Number2;
cout<<"Please insert your first number";
cin>>Number1;
cout<<"please insert what you want to do, +,-,* or /";
cin>>Action;
cout<<"please insert your second number";
cin>>Number2;
//end of "Input" module
//start of "ProcessNumbers" module.
int ProcessNumbers();
while (MoreNumbers==0){
Input();
cout<<"The calculation is"<<Number1+Action+Number2<<"\n";
TotalCounter = Number1+Action+Number2;
cout<<"are there more numbers to be calculated? Y=0, N=1";
cin>>MoreNumbers;
}
//end of "ProcessNumbers" module.
int DisplayOutput();
cout<<TotalCounter;
//end of "ProcessNumbers" module
return 0;
}
when i compiled it said everything is ok (no errors or warnings), but when i clicked build i got 3 errors, i got no idea where i stuffed up..
The errors are:
Linking...
Try.obj : error LNK2001: unresolved external symbol "int __cdecl Input(void)" (?Input@@YAHXZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/Try.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Can anyone see the problem?? also, i kno there must be some logic errors there as this is the first time im doing something like this,in particular the line
" TotalCounter = Number1+Action+Number2;" doesent seem right to me, does anyone know if this is right? and if its not, how can i go around this problem?
thank you to anyone who goes out of their way to help me...
:(