Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
Type your program source Select your Operating System click compile and download your executable file!
This is the C/C++ Online Compiler.
In online compilers (.net) you can find and use online many compilers ( GCC, MINGW, GFORTRAN, JAVA, GPC, FREEBASIC) for the mainstream languages that exist, you can search THE LINUX MANUAL (DEV MAN) PAGES, the JAVA & WIN32 API'S. Also, i have gathered some material to get you started with programming.
Latest User Submitted Question!

Name: wrrrrr
Title:
  1rrrrrrrrrrrrrrrrrrrrr
Question:
#include<iostream.h>

     int roti1, roti2, bahan1, bahan2, bahan3, bahan4, bahan5, bahan6, bahan7,pilihanRoti,pilihanBahan;
     double hargaRoti1, hargaRoti2, hargaBahan1, hargaBahan2, hargaBahan3, hargaBahan4, hargaBahan5, hargaBahan6, hargaBahan7, hargaRoti=0, hargaPenuh;
     char yn;

void roti()
{
     cout<<"\t\t1. Wholemeal Bread : RM1.20\n";
     cout<<"\t\t2. White Bread : RM1.00";

     cout<<"\n\nBread option : ";
     cin>>pilihanRoti;

     switch(pilihanRoti)
     {
     case 1:
          
               hargaRoti1 = 1.20;
               cout<<"You choose Wholemeal Bread RM1.20\n\n";
               hargaRoti = hargaRoti hargaRoti1;
               break;
          
     case 2:
          
               hargaRoti2 = 1.00;
               cout<<"You choose White Bread RM1.\n\n";
               hargaRoti = hargaRoti hargaRoti2;
               break;
          
     default:
          
               cout<<"Wrong input";
               roti();
     }
}

void bahan()
{
     cout<<"\t\t1. Lettuce : RM0.80\n";
     cout<<"\t\t2. Tomatoes : RM1.00\n";
     cout<<"\t\t3. Cucumbers : RM0.80\n";
     cout<<"\t\t4. Green pepepers : RM1.00\n";
     cout<<"\t\t5. Onion: RM0.50\n";
     cout<<"\t\t6. Single cheese slice : RM1.00\n";
     cout<<"\t\t7. Double cheese slice : RM2.00";

     cout<<"\n\nIngredients option : ";
     cin>>pilihanBahan;

     switch(pilihanBahan)
     {
     case 1:

          hargaBahan1 = 0.80;
          cout<<"You choose Lettuce RM0.80";
          cout<<"\nWould you like to choose more? (y/n): ";
          cin>>yn;

          if(yn == 'y')
          {
               bahan();
          }
          else
          {
               hargaPenuh = hargaBahan1 hargaRoti;
               cout<<"Total price : RM"<<hargaPenuh<<endl;
          }
          break;

     case 2:
          
          hargaBahan2 = 1.00;
          cout<<"You choose Tomatoes : RM1.00";
          cout<<"\nWould you like to choose more? (y/n): ";
          cin>>yn;

          if(yn == 'y')
          {
               bahan();
          }
          else
          {
               hargaPenuh = hargaBahan2 hargaRoti;
               cout<<"Total price : RM"<<hargaPenuh<<endl;
          }
          break;

     case 3:

          hargaBahan3 = 0.80;
          cout<<"You choose Cucumbers : RM0.80";
          cout<<"\nWould you like to choose more? (y/n): ";
          cin>>yn;

          if(yn == 'y')
          {
               bahan();
          }
          else
          {
               hargaPenuh = hargaBahan3 hargaRoti;
               cout<<"Total price : RM"<<hargaPenuh<<endl;
          }
          break;

     case 4:

          hargaBahan4 = 1.00;
          cout<<"You choose Green pepepers : RM1.00";
          cout<<"\nWould you like to choose more? (y/n): ";
          cin>>yn;

          if(yn == 'y')
          {
               bahan();
          }
          else
          {
               hargaPenuh = hargaBahan4 hargaRoti;
               cout<<"Total price : RM"<<hargaPenuh<<endl;
          }
          break;

     case 5:

          hargaBahan5 = 0.50;
          cout<<"You choose Onion: RM0.50";
          cout<<"\nWould you like to choose more? (y/n): ";
          cin>>yn;

          if(yn == 'y')
          {
               bahan();
          }
          else
          {
               hargaPenuh = hargaBahan5 hargaRoti;
               cout<<"Total price : RM"<<hargaPenuh<<endl;
          }
          break;

     case 6:

          hargaBahan6 = 1.00;
          cout<<"You choose Single cheese slice : RM1.00";
          cout<<"\nWould you like to choose more? (y/n): ";
          cin>>yn;

          if(yn == 'y')
          {
               bahan();
          }
          else
          {
               hargaPenuh = hargaBahan6 hargaRoti;
               cout<<"Total price : RM"<<hargaPenuh<<endl;
          }
          break;

     case 7:

          hargaBahan7 = 2.00;
          cout<<"You choose Double cheese slice RM2.00";
          cout<<"\nWould you like to choose more? (y/n): ";
          cin>>yn;

          if(yn == 'y')
          {
               bahan();
          }
          else
          {
               hargaPenuh = hargaBahan7 hargaRoti;
               cout<<"Total price : RM"<<hargaPenuh<<endl;
          }
          break;

     default:

          cout<<"Wrong input";
          bahan();
     }
}

void main()
{
     roti();
     bahan();
}
Answers: Name: ...
..........