3 Replies - 360 Views - Last Post: 10 March 2010 - 08:52 PM Rate Topic: -----

#1 1revantheforgotton  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 06-February 10

Why does the compilier have errors

Posted 10 March 2010 - 04:18 PM

Can't someone tell me why i have errors in my code? Thanks (i am using DEVC++)

 
#include <iostream>
using namespace std;

    int choicetoys( int choicetoy);
    int choicesmalls(int choicesmall);
    int choicemediums(int choicemedium);
    int choicelarges(int choicelarge);
    int choicegiants(int choicegiant);
    int choices(int choice);
int main ()
   {
      int choicetoy;
      int enter;
      int choicesmall;
      int choicemedium;
      int choicelarge;
      int choicegiant;
      int contin;
      int choice;
      int final_answer; 
         do
         {
                     
        cout << endl 
             << "Hello and welcome to Zeedick Pet Store Management, Inc.\
                Your call may be recorded to insure top quality customer service.\
                Please choose the size of your dog.\n"
             << "Press 1 for toy size.\n"  
             << "Press 2 for small size.\n"
             << "Press 3 for medium size.\n"
             << "Press 4 to large size.\n"
             << "Press 5 to giant size.\n"
             << "Enter your choice and press Enter: ";
        cin >> enter;
        
        switch (enter)
         {
case 1:
                    cout << "You have choosen 'toy'. Here are your options.\n"
                         << "press 1 to adopt a Yorkie and press enter.\n" 
                         << "press 2 to adopt a Pug and press enter.\n" 
                         << "press 3 to adopt a Chihuahua and press enter.\n"
                         << "Enter your choice and press enter: "; 
                    cin >> choicetoy;
                   
                   final_answer = choicetoys(choicetoy);
                           
         break;            
            
case 2:
                    cout << "You have choosen 'small'. Here are your options.\n"
                         << "Press 1 to adopt a Corgi and press enter.\n"
                         << "Press 2 to adopt a Scottish Terrier and press enter.\n" 
                         << "Press 3 to adopt a Bichon Frise and press enter.\n";
                    cin >>  choicesmall;                  
                   final_answer = choicesmalls(choicesmall);
                  
                      
         break;      
case 3:
                    cout << "You have choosen 'Medium'. Here are your options.\n"
                         << "Press 1 to adopt a Cocker Spaniel and press enter.\n"
                         << "Press 2 to adopt a Springer Spaniel and press enter.\n" 
                         << "Press 3 to adopt a Clumber Spaniel and press enter.\n";

                    cin >> choicemedium;                  
                    final_answer = choicemediums(choicemedium);                  
                      
        break;
case 4:
                    cout << "You have choosen 'Large'. Here are your options.\n"
                         << "Press 1 to adopt a Doberman and press enter.\n"
                         << "Press 2 to adopt a Setter and press enter.\n" 
                         << "Press 3 to adopt a Weimeraner and press enter.\n";

                    cin >> choicelarge;                  
                    final_answer = choicelarges(choicelarge);
        break;
                  
case 5:
                    cout << "You have choosen 'Giant'. Here are your options.\n"
                         << "Press 1 to adopt a Irish Wolfhound and press enter.\n"
                         << "Press 2 to adopt a St. Bernard and press enter.\n" 
                         << "Press 3 to adopt a Scottish Dearhound and press enter.\n";

                    cin >> choicegiant;                  
                  final_answer = choicegiants(choicegiant);
                         
         
         break;
                      default:
                              cout << "WOOF! That choice is not available.\n";
                              break;
                              }
                                                  
                          if(contin == 1)  
                                                    {
                                    enter=0;
                                    }
                             
                      }while(contin == 1); 
                      
                      if (contin = 2)
                      {
                                 cout << "Thank you and please come back to get more dogs!! WOOF!!\n";
                                 }
system("pause");
 return 0;      

}       
   int choicetoys(int choicetoy)
{
       int final_answer;
              switch (choicetoy)
       {
              case 1:
                                    
                                    cout  << "Congradulations you have adopted a Toy Yorkie. \n"
                                              "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n" ;
                                          
           cin >> final_answer; 
            
            
             break;
               case 2:
                                    cout  << " Congradulations you have adopted a Toy Pug.\n"
                                          <<   "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                          << "Press y to adopt more dogs.\n"
                                          << "Press n to not adopt.\n";
                                          cin >> final_answer;
               
                  break;                   
              case 3:
                                     cout  << " Congradulations you have adopted a Toy Chihuahua.\n"
                                           << "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                    cin >> final_answer;
              break;
             
              
}

   int choicesmalls(int choicesmall)
{
       int final_answer;
              switch (choicesmall)
       {
              case 1:
                                    
                                    cout  << " Congradulations you have adopted a Small Corgi.\n"
                                           <<   "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                                          
           cin >> final_answer;
            
            
             break;
               case 2:
                                    cout  << " Congradulations you have adopted a Small Scottish Terrier.\n"
                                           <<  "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                          << "Press y to adopt more dogs.\n"
                                          << "Press n to not adopt.\n";
                                          cin >> final_answer;
               
                  break;                   
              case 3:
                                       cout  << " Congradulations you have adopted a Small Bichon Frise.\n"
                                            <<  "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                    cin >> final_answer;
              break;
             
              
}

   int choicemediums(int choicemedium)
{
       int final_answer;
              switch (choicemedium)
       {
              case 1:
                                    
                                    cout  << " Congradulations you have adopted a Medium Cocker Spaniel.\n"
                                            <<  "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                                          
           cin >> final_answer; 
            
            
             break;
               case 2:
                                    cout  << " Congradulations you have adopted a Medium Springer Spaniel.\n"
                                           <<  "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                          << "Press y to adopt more dogs.\n"
                                          << "Press n to not adopt.\n";
                                          cin >> final_answer;
               
                  break;                   
              case 3:
                                     cout  << "Congradulations you have adopted a Medium Clumber Spaniel.\n"
                                           << "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                    cin >> final_answer;
              break;
             
              
}

   int choicelarges(int choicelarge)
{
       int final_answer;
              switch (choicelarge)
       {
              case 1:
                                    
                                     cout  << " Congradulations you have adopted a Large Doberman.\n"
                                           << "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                                          
           cin >> final_answer;
            
            
             break;
               case 2:
                                       cout  << " Congradulations you have adopted a Large Setter.\n"
                                          << "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                          << "Press y to adopt more dogs.\n"
                                          << "Press n to not adopt.\n";
                                          cin >> final_answer;
               
                  break;                   
              case 3:
                                    cout  << " Congradulations you have adopted a Large Weimeraner.\n"
                                           << "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                    cin >>final_answer;
              break;
             
              
}
                    
                              

   int choicegiants(int choicegiant)
{
       int final_answer;
              switch (choicegiant)
       {
              case 1:
                                    
                                   cout  << " Congradulations you have adopted a Giant Irish Wolfhound.\n"
                                           <<  "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                                          
           cin >> final_answer; // This is a function that takes an input from the user and puts it into tempory memory
            
            
             break;
               case 2:
                                    cout  << " Congradulations you have adopted a Giant St. Bernard.\n"
                                          <<  "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                          << "Press y to adopt more dogs.\n"
                                          << "Press n to not adopt.\n";
                                          cin >> final_answer;
               
                  break;                   
              case 3:
                                      cout  << " Congradulations you have adopted a Giant Scottish Dearhound.\n"
                                           << "THANKS FOR ADOPTING A DOG! Would you like to adopt some more?\n"
                                           << "Press y to adopt more dogs.\n"
                                           << "Press n to not adopt.\n";
                    cin >>final_answer;
              break;
             
              
}
 




Is This A Good Question/Topic? 0
  • +

Replies To: Why does the compilier have errors

#2 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3077
  • View blog
  • Posts: 10,792
  • Joined: 08-August 08

Re: Why does the compilier have errors

Posted 10 March 2010 - 04:26 PM

It's because you haven't made the effort to debug your code. Seriously, what have you tried?
Was This Post Helpful? 0
  • +
  • -

#3 Guest_c.user*


Reputation:

Re: Why does the compilier have errors

Posted 10 March 2010 - 06:53 PM

I see there are no closing brackets of functions choicelarges, choicegiants
and similar ones, I think the author was using copy&paste

This post has been edited by c.user: 10 March 2010 - 06:55 PM

Was This Post Helpful? 0

#4 DJPlayer  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 73
  • Joined: 19-September 07

Re: Why does the compilier have errors

Posted 10 March 2010 - 08:52 PM

in 2 seconds I noticed a system("pause") which is not part of the iostream library.. seriously you could at least include your compile errors...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1