| | |
currency conversion program error
![]() |
•
•
Join Date: Oct 2006
Posts: 10
Reputation:
Solved Threads: 0
ive created this currency conversion program
which converts the currency then adds commission, but its got a error saying undefined symbol true in function main
can someone help me ive only got the one error with it.
which converts the currency then adds commission, but its got a error saying undefined symbol true in function main
can someone help me ive only got the one error with it.
C++ Syntax (Toggle Plain Text)
#include <iostream.h> int choice; double pounds; double USdollar; double Euro; double interest; int main(){ cout << "Select what you want to convert." <<endl; cout << "1.Pounds to US dollar." <<endl; cout << "2.Pounds to Euro." << endl; cin >> choice; while (true){ //converts pounds to US dollars if (choice == 1){ cout << "Please enter amount you want to convert." <<endl; cin >> pounds; USdollar = pounds * 0.5; //change the conversion rate cout << USdollar<< endl; if (pounds <= 1000){ cout << "Interest rate is 1% of this amount." <<endl; interest = USdollar + (USdollar * 0.01); cout << interest << endl; } if (pounds > 1000){ cout << "Interest rate is 3% of this amount." <<endl; interest = USdollar + (USdollar * 0.03); cout << interest << endl; }break; } //converts pounds to euro if (choice == 2){ cout << "Please enter amount you want to convert." <<endl; cin >> pounds; Euro = pounds * 0.3; //change the conversion rate cout << Euro<< endl; if (pounds <= 1000){ cout << "Interest rate is 1% of this amount." <<endl; interest = Euro + (Euro * 0.01); cout << interest << endl; } if (pounds > 1000){ cout << "Interest rate is 3% of this amount." <<endl; interest = Euro + (Euro * 0.03); cout << interest << endl; }break; } if (choice != 1 && choice !=2){ cout <<"Invalid choice. Enter again."<<endl; } }return 0; }
Last edited by sunny123; Nov 29th, 2006 at 12:11 pm.
•
•
Join Date: Oct 2006
Posts: 57
Reputation:
Solved Threads: 2
It works fine on my compiler :-S
Try declaring a boolean variable and have that in the while loop
Or simply use the forever loop
Try declaring a boolean variable and have that in the while loop
C++ Syntax (Toggle Plain Text)
bool keepLooping = true; ... while (keepLooping) { ... }
Or simply use the forever loop
C++ Syntax (Toggle Plain Text)
for (;;) { ... }
iostream.h is outdated - use
http://www.devx.com/tips/Tip/14447
(you also either need to put
My suspection of "undefined symbol true" is that the compiler is in 'C' mode or something... perhaps in the configuration or something you can change it. In any case, it works fine on mine (gcc).
What an awful way of doing it. Firstly, if the compiler doesn't recognize
That should work for ya.
iostream instead:http://www.devx.com/tips/Tip/14447
(you also either need to put
using namespace std; after the inclusion of iostream, or place std:: in front of each Standard Template Library object)My suspection of "undefined symbol true" is that the compiler is in 'C' mode or something... perhaps in the configuration or something you can change it. In any case, it works fine on mine (gcc).
•
•
•
•
Originally Posted by may4life
Try declaring a boolean variable and have that in the while loop
Code:
C++ Syntax (Toggle Plain Text)
bool keepLooping = true; ... while (keepLooping) { ... }
true in the while loop, what makes you think it will recognize it in a variable assignment? Secondly, it's much shorter to simply create a while loop with '1' like the following: C++ Syntax (Toggle Plain Text)
while(1) { ... }
"Technological progress is like an axe in the hands of a pathological criminal."
![]() |
Similar Threads
- currency interest program need help coding it further (C++)
- program error for cd burner program (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: four function in maim II
- Next Thread: Stuck
| Thread Tools | Search this Thread |
api array based binary bitmap business c++ c/c++ char class classes code coding commentinghelp compile console conversion count decide delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez graph guess gui homeworkhelp homeworkhelper iamthwee ifpug ifstream incrementoperators infinite input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem proficiency program programming project python random read recursion reference rpg string strings temperature template templates test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






