Welcome to Dream.In.Code
Become a C++ Expert!

Join 150,020 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,502 people online right now. Registration is fast and FREE... Join Now!




undefined symbol in function main

 
Reply to this topicStart new topic

undefined symbol in function main, currency program one error

sunny123
29 Nov, 2006 - 08:05 AM
Post #1

New D.I.C Head
*

Joined: 19 Oct, 2006
Posts: 11


My Contributions
ive got this program and its got a error saying
undefined symbol 'true' in function main.
its only one error with the whole program but i dnt know how to fix it
can someone help me fix it.



CODE
#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;
}


edit: modified title ~ jayman9
User is offlineProfile CardPM
+Quote Post

may4life
RE: Undefined Symbol In Function Main
29 Nov, 2006 - 09:37 AM
Post #2

New D.I.C Head
*

Joined: 5 Nov, 2006
Posts: 23


My Contributions
Hello again..
use either
CODE

bool keepLooping = true;

while (keepLooping)
{
...
}


or use the forever loop
CODE

for (;;)
{
...
}

User is offlineProfile CardPM
+Quote Post

sunny123
RE: Undefined Symbol In Function Main
29 Nov, 2006 - 02:38 PM
Post #3

New D.I.C Head
*

Joined: 19 Oct, 2006
Posts: 11


My Contributions
thankyou the program works now

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 09:19PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month