Hi guys

Actually i have problem to convert my C++ program to C!
Because C is too old and unusable, i tried to find and read so many sources, but finally i got some errors.
Anyone can help me?!
Thanks
Regards

C++ Files:
Main.cpp

#include  <iostream>
#include  <cstring>
#include  <cstdlib>
#include  <iomanip>
#include <vector>
#include "Display.h"


using namespace std;


/****************************************************************
   decleration  classes & data Structure
****************************************************************/

Display    display;

vector<int>  prices;
vector<int>  weight;
/****************************************************************
   Main method
****************************************************************/
int main(){

   display.DisplayMenu();

     char choice ;

     int done = 0 ;

     int vc ;
     int i1,i2,i3,i4,i5,i6;
     int w1,w2,w3,w4,w5,w6;
     double totalprice;
     int totalweight;

      while (!done){

      cin >> choice ;

      switch(choice){

/****************************************************************
   case 1 : Dry   Cleaning  services
****************************************************************/

     case '1':

         display.DisplayDryCleaningservices();

        int  s  ;

         s = 0 ;
         char ch ;
          cout << "\n";
          cout << "press 'c' to continue 'b' to BACK\n";

          while(!s){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayDryCleaningservices();

             cout << endl << endl << endl;
             cout << "Which item is your choice   ? " ;cin >> i1;


             double price1;
             double price11;
              switch(i1){

              case 1 :
               price1 = 20 ;
              break;

              case 2:
              price1 = 10 ;
              break;

              case 3:
              price1 = 15 ;
              break;

              case 4:
              price1 = 15;
              break;

              case 5:
              price1 = 15;
              break;

              case 6:
              price1 = 20;
              break;

              default:
               cout << "enter wrong number ";

             }


             cout << endl << endl << endl;
             cout << "how many kilogram is your item ? " ;cin >> w1;
             price11 = price1 * w1;
             prices.push_back(price11);
             weight.push_back(w1);
             cout << endl << endl << endl;
              cout << "press  'b' to BACK\n";


             break;

            case 'b':
             s = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            cout << "enter wrong choice ...!\n";
         }
    }




    break;

/****************************************************************
   case 2 : Hand    Wash   services
****************************************************************/

       case '2':

       bool  i1,j1;

        int   i2,j2 ;
        int w ;
        w = 0 ;

        char choq;

       display.Displayhandwashservices();
       cout << "\n";
        cout << "press 'c' to continue 'b' to BACK\n";
       while(!w){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
              display.Displayhandwashservices();

             cout << endl << endl << endl;
             cout << "Which item is your choice   ? " ;cin >> i2;


             double price2;
             double price22;
             switch(i2){

              case 1 :
               price2 = 5 ;
              break;


              default:
               cout << "enter wrong number ";

             }


             cout << endl << endl << endl;
             cout << "how many kilogram is your  item? " ;cin >> w2;
             price22 = price2 * w2 ;
             prices.push_back(price22);
             weight.push_back(w2);
             cout << endl << endl << endl;
             cout << "press  'b' to BACK\n";
             break;

            case 'b':
             w = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            cout << "enter wrong choice ...!\n";
         }
    }

      break;

/****************************************************************
   case 3 : General Washing  Services
****************************************************************/

       case '3':

       bool  i11;
       int   i21 ;
       int  r ;
       r = 0 ;

       char choq1;

       display.DisplayGeneralWashingServices();
        cout << "\n";
        cout << "press 'c' to continue 'b' to BACK\n";
       while(!r){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");

              display.DisplayGeneralWashingServices();

              cout << endl << endl << endl;
              cout << "Which item is your choice   ? " ;cin >> i3;


             double price3;
             double price33;
             switch(i3){

              case 1 :
               price3 = 10 ;
              break;

              case 2:
              price3 = 8 ;
              break;

              case 3:
              price3 = 11 ;
              break;

              case 4:
              price3 = 15;
              break;

              case 5:
              price3 = 9;
              break;

              case 6:
              price3 = 10;
              break;

              default:
               cout << "enter wrong number ";

             }


             cout << endl << endl << endl;
             cout << "how many kilo gram are your ? " ;cin >> w3;
             price33 = price3 * w3 ;
             prices.push_back(price33);
             weight.push_back(w3);
             cout << endl << endl << endl;
             cout << "press  'b' to BACK\n";
             break;

            case 'b':
             r = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            cout << "enter wrong choice ...!\n";
         }
    }




       break;

/****************************************************************
   case 4 :Ironing  Services
****************************************************************/
       case '4':

         int z;

         z = 0;

         char choi;

         char  x[20] ;

         display.DisplayIroningServices();
          cout << "\n";
          cout << "press 'c' to continue 'b' to BACK\n";

          while(!z){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayIroningServices();

             cout << endl << endl << endl;
             cout << "Which item is your choice   ? " ;cin >> i4;


             double price4;
             double price44;
             switch(i4){

              case 1 :
               price4 = 1 ;
              break;

              case 2:
              price4 = 0.8 ;
              break;

              case 3:
              price4 = 1.2 ;
              break;

              case 4:
              price4 = 3 ;
              break;

              case 5:
              price4 = 4;
              break;

              default:
               cout << "enter wrong number ";

             }


             cout << endl << endl << endl;
             cout << "how many kilo gram are your ? " ;cin >> w4;
             price44 = price4 * w4;
             prices.push_back(price44);
             weight.push_back(w4);
             cout << endl << endl << endl;
             cout << "press  'b' to BACK\n";


             break;

            case 'b':
             z = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            cout << "enter wrong choice ...!\n";
         }
    }




       break;

/****************************************************************
   case 5 :Clothes Mending  Services
****************************************************************/

       case '5':
         char cho;
         int f;
         f = 0 ;
         display.Displayclothesmendingservices();
          cout << "\n";
          cout << "press 'c' to continue 'b' to BACK\n";
         while(!f){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.Displayclothesmendingservices();

             cout << endl << endl << endl;
             cout << "Which item is your choice   ? " ;cin >> i5;


             double price5;
             double price55;
             switch(i5){

              case 1 :
               price5 = 3.5 ;
              break;


              default:
               cout << "enter wrong number ";

             }

             cout << endl << endl << endl;
             cout << "how many kilo gram are your ? " ;cin >> w5;
             price55 = price5 * w5 ;
             prices.push_back(price5);
             weight.push_back(w5);
             cout << endl << endl << endl;
             cout << "press  'b' to BACK\n";

             break;

            case 'b':
             f = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            cout << "enter wrong choice ...!\n";
         }
    }
    break;

/****************************************************************
   case 6 :Stain  Removing  Service
****************************************************************/
     case '6':

        display.DisplayStainRemovingServices();

        int  y ;

        y = 0 ;

         char cho3 ;

          cout << "\n";
           cout << "press 'c' to continue 'b' to BACK\n";

           while(!y){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayStainRemovingServices();

             cout << endl << endl << endl;
             cout << "Which item is your choice   ? " ;cin >> i6;


             double price6;
             double price66;
             switch(i6){

              case 1 :
               price6 = 5 ;
              break;

              case 2:
              price6 = 3 ;
              break;

              case 3:
              price6 = 2 ;
              break;



              default:
               cout << "enter wrong number ";

             }


             cout << endl << endl << endl;
             cout << "how many kilo gram are your ? " ;cin >> w6;
             price66 = price6 * w6 ;
             prices.push_back(price6);
             weight.push_back(w6);
             cout << endl << endl << endl;
             cout << "press  'b' to BACK\n";

             break;

            case 'b':
             y = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            cout << "enter wrong choice ...!\n";
         }
    }
break;

/****************************************************************
   case 7 :Costumer Receipt
****************************************************************/
     case '7':

        display.DisplayCostumerReceipt();

        int  o ;

        o = 0 ;

         char cho33 ;

          cout << "\n";
          cout << "press 'c' to continue 'b' to BACK\n";

           while(!o){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayCostumerReceipt();
             cout << "press  'b' to BACK\n";
             cout << endl<<endl<<endl;

             totalprice = prices[0] +prices[1]+prices[2]+prices[3]+prices[4]+prices[5];

             cout <<"Total price is  :>  " << totalprice << " RM" << endl << endl << endl;

             totalweight = weight[0]+weight[1]+weight[2]+weight[3]+weight[4]+weight[5];

             cout <<"Total weight is :>  " << totalweight;


             break;

            case 'b':
             o = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            cout << "enter wrong choice ...!\n";
         }
    }

        break;


/****************************************************************
   case 8 :Exit
****************************************************************/
       case '0':
          done = 1 ;
       break;

       default:
       cout << "Enter wrong choice ..!! \n";
       cout << "try it again ...\n";

  }  // switch
 } // while
return 0;
}//main

Display.cpp

#include "Display.h"
#include <iostream>
#include <cstdlib>

using namespace std;

Display::Display()
{
    //ctor
}

Display::~Display()
{
    //dtor
}

/****************************************************************
   FUNCTION:   Display Menu
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/
void  Display::DisplayMenu(){

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                        M A I N          M  E  N  U                          |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 1 |  Dry Cleaning     services                                              |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 2 |  Hand Wash        services                                              |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 3 |  General Washing  Services                                              |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 4 |  Ironing          Services                                              |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 5 |  Clothes Mending  Services                                              |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 6 |  Stain  Removing  Service                                               |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 7 |  Costumer receipt                                                       |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 0 |  exit                                                                   |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;

cout <<"\n";

cout <<"Enter your choice :\n";

}

/****************************************************************
   FUNCTION:   Display  Dry  Cleaning  services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayDryCleaningservices(){

system("cls");

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                 Dry Cleaning Services (per item basis)                      |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 1 |  Coat          RM20                                                   |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 2 |  Pants         RM10                                                   |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 3 |  Sari          RM15                                                   |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 4 |  Cheong Sam      RM15                                                   |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 5 |  Party Dress    RM15                                                  |\n" ;
cout <<"|___|_______________________________ _________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 6 |  Baju Kurung    RM20                                                  |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;



}
/****************************************************************
   FUNCTION:   Display hand wash services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::Displayhandwashservices(){

system("cls");

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                hand wash services (per item basis)                          |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 1 |  Items          RM5                                                   |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;

}

/****************************************************************
   FUNCTION :  Display  General Washing  Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayGeneralWashingServices(){

system("cls");

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                 General Washing  Services (per item basis)                  |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 1 |  White Load RM10.00                                               |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 2 |  Coloured Load  RM8.00                                                |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 3 |  Wools      RM12.00                                               |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 4 |  Fine Materials RM15.00                                               |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 5 |  Toys           RM9.00                                                |\n" ;
cout <<"|___|_______________________________ _________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 6 |  Comforters RM10.00                                               |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;

}
/****************************************************************
   FUNCTION :  Display  Ironing Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayIroningServices(){

system("cls");

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                         Ironing Services                                    |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 1 |  Shirts     RM1.00                                                |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 2 |  Pants      RM0.80                                                |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 3 |  Skirts     RM1.20                                                |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 4 |  Dresses        RM3.00                                                |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 5 |  Suits          RM4.00                                                |\n" ;
cout <<"|___|_______________________________ _________________________________________|\n" ;

}

/****************************************************************
   FUNCTION:   Display clothes mending services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::Displayclothesmendingservices(){

system("cls");

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                   clothes       mending       services                      |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 1 |  Items          RM3.5                                                 |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;

}
/****************************************************************
   FUNCTION:   Display  Stain  Removing  Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayStainRemovingServices(){

system("cls");

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                   Stain       Removing            Services                  |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 1 |  Oil Stain          RM5.00                                        |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 2 | Blood Stain       RM3.00                                      |\n" ;
cout <<"|___|______________________________________ __________________________________|\n" ;
cout <<"|   |                                                                         |\n" ;
cout <<"| 3 | General dirt Stain  RM2.00                                        |\n" ;
cout <<"|___|_________________________________________________________________________|\n" ;

}
/****************************************************************
   FUNCTION:   Costumer Receipt
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayCostumerReceipt(){

system("cls");

cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|          Laundrette      Load       Calculating         System              |\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|*****************************************************************************|\n" ;
cout <<"|-----------------------------------------------------------------------------|\n" ;
cout <<"|                                                                             |\n" ;
cout <<"|                       Costumer     Receipt                                  |\n" ;
cout <<"|_____________________________________________________________________________|\n" ;
}

Display.h

#ifndef DISPLAY_H
#define DISPLAY_H


class Display
{
    public:
        Display();
        virtual ~Display();
        void DisplayMenu();
        void DisplayDryCleaningservices();
        void Displayhandwashservices();
        void DisplayGeneralWashingServices();
        void DisplayIroningServices();
        void Displayclothesmendingservices();
        void DisplayStainRemovingServices();
        void DisplayCostumerReceipt();
    private:
};

#endif // DISPLAY_H

-----------------------------------------------------------------------------------------
Now after conversin to C language:
Main.c

#include  <iostream>
#include  <cstring>
#include  <cstdlib>
#include  <iomanip>
#include <vector>
#include "Display.h"


using namespace std;


/****************************************************************
   decleration  classes & data Structure
****************************************************************/

Display    display;

vector<int>  prices;
vector<int>  weight;
/****************************************************************
   Main method
****************************************************************/
int main(){

   display.DisplayMenu();

     char choice ;

     int done = 0 ;

     int vc ;
     int i1,i2,i3,i4,i5,i6;
     int w1,w2,w3,w4,w5,w6;
     double totalprice;
     int totalweight;

      while (!done){

      cin >> choice ;

      switch(choice){

/****************************************************************
   case 1 : Dry   Cleaning  services
****************************************************************/

     case '1':

         display.DisplayDryCleaningservices();

        int  s  ;

         s = 0 ;
         char ch ;
          cout << "\n";
          cout << "press 'c' to continue 'b' to BACK\n";

          while(!s){

        scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayDryCleaningservices();

              printf("Which item is your choice   ? ") ;scanf("%d",&i1);


             double price1;
             double price11;
              switch(i1){

              case 1 :
               price1 = 20 ;
              break;

              case 2:
              price1 = 10 ;
              break;

              case 3:
              price1 = 15 ;
              break;

              case 4:
              price1 = 15;
              break;

              case 5:
              price1 = 15;
              break;

              case 6:
              price1 = 20;
              break;

              default:
               cout << "enter wrong number ";

             }

           printf("how many kilogram is your item ? " );scanf("%d",&w1);
             price11 = price1 * w1;
             prices.push_back(price11);
             weight.push_back(w1);
             printf("press  'b' to BACK\n");
             break;

            case 'b':
             s = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }




    break;

/****************************************************************
   case 2 : Hand    Wash   services
****************************************************************/

       case '2':

       bool  i1,j1;

        int   i2,j2 ;
        int w ;
        w = 0 ;

        char choq;

       display.Displayhandwashservices();

        printf("press 'c' to continue 'b' to BACK\n");
       while(!w){

          scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");
              display.Displayhandwashservices();


             printf("Which item is your choice   ? ") ;scanf("%d",&i2);
;


             double price2;
             double price22;
             switch(i2){

              case 1 :
               price2 = 5 ;
              break;


              default:
               printf("enter wrong number ");

             }



              printf( "how many kilogram is your  item? ") ;scanf("%d",&w2);
;
             price22 = price2 * w2 ;
             prices.push_back(price22);
             weight.push_back(w2);

             printf( "press  'b' to BACK\n");
             break;

            case 'b':
             w = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
             printf("enter wrong choice ...!\n");
         }
    }

      break;

/****************************************************************
   case 3 : General Washing  Services
****************************************************************/

       case '3':

       bool  i11;
       int   i21 ;
       int  r ;
       r = 0 ;

       char choq1;

       display.DisplayGeneralWashingServices();

        printf("press 'c' to continue 'b' to BACK\n");
       while(!r){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");

              display.DisplayGeneralWashingServices();


              printf("Which item is your choice   ? " );scanf("%d",&i3);
;


             double price3;
             double price33;
             switch(i3){

              case 1 :
               price3 = 10 ;
              break;

              case 2:
              price3 = 8 ;
              break;

              case 3:
              price3 = 11 ;
              break;

              case 4:
              price3 = 15;
              break;

              case 5:
              price3 = 9;
              break;

              case 6:
              price3 = 10;
              break;

              default:
               printf("enter wrong number ");

             }



             printf("how many kilo gram are your ? ") ;scanf("%d",&i3);
;
             price33 = price3 * w3 ;
             prices.push_back(price33);
             weight.push_back(w3);

             printf( "press  'b' to BACK\n");
             break;

            case 'b':
             r = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
             printf("enter wrong choice ...!\n");
         }
    }




       break;

/****************************************************************
   case 4 :Ironing  Services
****************************************************************/
       case '4':

         int z;

         z = 0;

         char choi;

         char  x[20] ;

         display.DisplayIroningServices();

          printf("press 'c' to continue 'b' to BACK\n");

          while(!z){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayIroningServices();


             printf("Which item is your choice   ? ") ;scanf("%d",&i4);
;


             double price4;
             double price44;
             switch(i4){

              case 1 :
               price4 = 1 ;
              break;

              case 2:
              price4 = 0.8 ;
              break;

              case 3:
              price4 = 1.2 ;
              break;

              case 4:
              price4 = 3 ;
              break;

              case 5:
              price4 = 4;
              break;

              default:
               printf("enter wrong number ");

             }



             printf("how many kilo gram are your ? " );scanf("%d",&w4);
;
             price44 = price4 * w4;
             prices.push_back(price44);
             weight.push_back(w4);

             printf("press  'b' to BACK\n");


             break;

            case 'b':
             z = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }




       break;

/****************************************************************
   case 5 :Clothes Mending  Services
****************************************************************/

       case '5':
         char cho;
         int f;
         f = 0 ;
         display.Displayclothesmendingservices();

          printf("press 'c' to continue 'b' to BACK\n");
         while(!f){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.Displayclothesmendingservices();


             printf ("Which item is your choice   ? ") ;scanf("%d",&i5);
;


             double price5;
             double price55;
             switch(i5){

              case 1 :
               price5 = 3.5 ;
              break;


              default:
               printf("enter wrong number ");

             }


             printf("how many kilo gram are your ? " );scanf("%d",&w5);
;
             price55 = price5 * w5 ;
             prices.push_back(price5);
             weight.push_back(w5);

             printf("press  'b' to BACK\n");

             break;

            case 'b':
             f = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }
    break;

/****************************************************************
   case 6 :Stain  Removing  Service
****************************************************************/
     case '6':

        display.DisplayStainRemovingServices();

        int  y ;

        y = 0 ;

         char cho3 ;


           printf("press 'c' to continue 'b' to BACK\n");

           while(!y){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayStainRemovingServices();


            printf("Which item is your choice   ? ") ;scanf("%d",&i6);
;


             double price6;
             double price66;
             switch(i6){

              case 1 :
               price6 = 5 ;
              break;

              case 2:
              price6 = 3 ;
              break;

              case 3:
              price6 = 2 ;
              break;



              default:
               printf("enter wrong number ");

             }



             printf("how many kilo gram are your ? ") ;scanf("%d",&w6);
;
             price66 = price6 * w6 ;
             prices.push_back(price6);
             weight.push_back(w6);

             printf("press  'b' to BACK\n");

             break;

            case 'b':
             y = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }
break;

/****************************************************************
   case 7 :Costumer Receipt
****************************************************************/
     case '7':

        display.DisplayCostumerReceipt();

        int  o ;

        o = 0 ;

         char cho33 ;


           printf("press 'c' to continue 'b' to BACK\n");

           while(!o){

           cin >> ch ;

           switch(ch){

            case 'c':

             system("cls");
             display.DisplayCostumerReceipt();
             printf("press  'b' to BACK\n");
             cout << endl<<endl<<endl;

             totalprice = prices[0] +prices[1]+prices[2]+prices[3]+prices[4]+prices[5];

             printf ("Total price is  :>  " );
             printf(totalprice);
             printf(" RM" );

             totalweight = weight[0]+weight[1]+weight[2]+weight[3]+weight[4]+weight[5];

             printf("Total weight is :>  ");printf(totalweight);

             break;

            case 'b':
             o = 1 ;
             system("cls");
             display.DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }

        break;


/****************************************************************
   case 8 :Exit
****************************************************************/
       case '0':
          done = 1 ;
       break;

       default:
       printf("Enter wrong choice ..!! \n");
       printf("try it again ...\n");

  }  // switch
 } // while
return 0;
}//main

Display.c

#include "Display.h"


using namespace std;

Display::Display()
{
    //ctor
}

Display::~Display()
{
    //dtor
}

/****************************************************************
   FUNCTION:   Display Menu
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/
void  Display::DisplayMenu(){

printf("|-----------------------------------------------------------------------------|\n")) ;
printf("|-----------------------------------------------------------------------------|\n")) ;
printf("|          Laundrette      Load       Calculating         System              |\n")) ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                        M A I N          M  E  N  U                          |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Dry Cleaning     services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Hand Wash        services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  General Washing  Services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Ironing          Services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Clothes Mending  Services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 6 |  Stain  Removing  Service                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 7 |  Costumer receipt                                                       |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 0 |  exit                                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

printf("\n");

printf("Enter your choice :\n");

}

/****************************************************************
   FUNCTION:   Display  Dry  Cleaning  services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayDryCleaningservices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                 Dry Cleaning Services (per item basis)                      |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Coat        RM20                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Pants           RM10                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  Sari        RM15                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Cheong Sam      RM15                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Party Dress  RM15                                                  |\n") ;
printf("|___|_______________________________ _________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 6 |  Baju Kurung  RM20                                                  |\n") ;
printf("|___|_________________________________________________________________________|\n") ;



}
/****************************************************************
   FUNCTION:   Display hand wash services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::Displayhandwashservices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                hand wash services (per item basis)                          |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Items            RM5                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}

/****************************************************************
   FUNCTION :  Display  General Washing  Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayGeneralWashingServices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                 General Washing  Services (per item basis)                  |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  White Load   RM10.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Coloured Load    RM8.00                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  Wools        RM12.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Fine Materials   RM15.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Toys         RM9.00                                                |\n") ;
printf("|___|_______________________________ _________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 6 |  Comforters   RM10.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}
/****************************************************************
   FUNCTION :  Display  Ironing Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayIroningServices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                         Ironing Services                                    |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Shirts       RM1.00                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Pants        RM0.80                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  Skirts       RM1.20                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Dresses      RM3.00                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Suits            RM4.00                                                |\n") ;
printf("|___|_______________________________ _________________________________________|\n") ;

}

/****************************************************************
   FUNCTION:   Display clothes mending services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::Displayclothesmendingservices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                   clothes       mending       services                      |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Items            RM3.5                                                 |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}
/****************************************************************
   FUNCTION:   Display  Stain  Removing  Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayStainRemovingServices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                   Stain       Removing            Services                  |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Oil Stain            RM5.00                                        |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 | Blood Stain         RM3.00                                      |\n") ;
printf("|___|______________________________________ __________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 | General dirt Stain    RM2.00                                        |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}
/****************************************************************
   FUNCTION:   Costumer Receipt
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Display::DisplayCostumerReceipt(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                       Costumer     Receipt                                  |\n") ;
printf("|_____________________________________________________________________________|\n") ;

}

------------------------------------------
Display.h

#ifndef DISPLAY_H
#define DISPLAY_H


class Display
{
    public:
        Display();
        virtual ~Display();
        void DisplayMenu();
        void DisplayDryCleaningservices();
        void Displayhandwashservices();
        void DisplayGeneralWashingServices();
        void DisplayIroningServices();
        void Displayclothesmendingservices();
        void DisplayStainRemovingServices();
        void DisplayCostumerReceipt();
    private:
};

#endif // DISPLAY_H

Recommended Answers

All 9 Replies

use struct, write your own vector

Because C is too old and unusable, i

C is older than c++ for sure, but hardly unusable! It's probably the most frequently used language in the world. Even today people are still writing code in C.

Before you can begin to convert your program from c++ to C you need to have at least a working knowledge of both languages so that you will know what the differences are. Just trying to compile that c++ program as if it were a c program won't work, as you have already found out.

The first thing you need to do is get rid of all those c++ header files and replace them with C standard header files. For example stdio.h, string.h, and stdlib.h. C doesn't know a thing about heder files with no extensions.

Next you need to convert c++ classes to structures and/or unions, then write normal global functions to processes those structures. The parameters to those functions will be a little different than the methods you find in c++ classes because C does not have a this pointer.

As for vectors, replace them with arrays.

Replace cout with printf() and cin with scanf(). Also replace fstream objects with FILE* and use fopen() and fclose() to open and close the file. The equivalent of c++ getline() is fgets()/

Thanks for your reply.
Actually i don't know what should i do with push_back! is there any replace things for push_back?!
Thanks

Finally i made this, but still hav errors.
Can you help me?!

#include  <stdio.h>
#include  <string.h>
#include  <stdlib.h>
/*#include  <iomanip>*/
#include <math.h>

void DisplayMenu(){

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                        M A I N          M  E  N  U                          |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Dry Cleaning     services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Hand Wash        services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  General Washing  Services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Ironing          Services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Clothes Mending  Services                                              |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 6 |  Stain  Removing  Service                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 7 |  Costumer receipt                                                       |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 0 |  exit                                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

printf("\n");

printf("Enter your choice :\n");

}

/****************************************************************
   FUNCTION:   Display  Dry  Cleaning  services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void DisplayDryCleaningservices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                 Dry Cleaning Services (per item basis)                      |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Coat        RM20                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Pants           RM10                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  Sari        RM15                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Cheong Sam      RM15                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Party Dress  RM15                                                  |\n") ;
printf("|___|_______________________________ _________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 6 |  Baju Kurung  RM20                                                  |\n") ;
printf("|___|_________________________________________________________________________|\n") ;



}
/****************************************************************
   FUNCTION:   Display hand wash services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Displayhandwashservices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                hand wash services (per item basis)                          |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Items            RM5                                                   |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}

/****************************************************************
   FUNCTION :  Display  General Washing  Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void DisplayGeneralWashingServices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                 General Washing  Services (per item basis)                  |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  White Load   RM10.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Coloured Load    RM8.00                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  Wools        RM12.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Fine Materials   RM15.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Toys         RM9.00                                                |\n") ;
printf("|___|_______________________________ _________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 6 |  Comforters   RM10.00                                               |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}
/****************************************************************
   FUNCTION :  Display  Ironing Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void DisplayIroningServices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                         Ironing Services                                    |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Shirts       RM1.00                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 |  Pants        RM0.80                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 |  Skirts       RM1.20                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 4 |  Dresses      RM3.00                                                |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 5 |  Suits            RM4.00                                                |\n") ;
printf("|___|_______________________________ _________________________________________|\n") ;

}

/****************************************************************
   FUNCTION:   Display clothes mending services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void Displayclothesmendingservices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                   clothes       mending       services                      |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Items            RM3.5                                                 |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}
/****************************************************************
   FUNCTION:   Display  Stain  Removing  Services
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void DisplayStainRemovingServices(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                   Stain       Removing            Services                  |\n") ;
printf("|_____________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 1 |  Oil Stain            RM5.00                                        |\n") ;
printf("|___|_________________________________________________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 2 | Blood Stain         RM3.00                                      |\n") ;
printf("|___|______________________________________ __________________________________|\n") ;
printf("|   |                                                                         |\n") ;
printf("| 3 | General dirt Stain    RM2.00                                        |\n") ;
printf("|___|_________________________________________________________________________|\n") ;

}
/****************************************************************
   FUNCTION:   Costumer Receipt
   ARGUMENTS:  none
   RETURNS:    none
   NOTES:
****************************************************************/

void DisplayCostumerReceipt(){

system("cls");

printf("|-----------------------------------------------------------------------------|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|          Laundrette      Load       Calculating         System              |\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|*****************************************************************************|\n") ;
printf("|-----------------------------------------------------------------------------|\n") ;
printf("|                                                                             |\n") ;
printf("|                       Costumer     Receipt                                  |\n") ;
printf("|_____________________________________________________________________________|\n") ;

}
/****************************************************************
   Main method
****************************************************************/
int main(){

   void DisplayMenu();

     char choice ;

     int done = 0 ;

     int vc ;
     int i1,i2,i3,i4,i5,i6;
     int w1,w2,w3,w4,w5,w6;
     double totalprice;
     int totalweight;

      while (!done){

      scanf("%d",&choice);

      switch(choice){

/****************************************************************
   case 1 : Dry   Cleaning  services
****************************************************************/

     case '1':
         {
        void DisplayDryCleaningservices();

        int  s=0  ;
         char ch;
          printf("\n");
          printf("press 'c' to continue 'b' to BACK\n");

          while(!s){

        scanf("%d",&ch);

           switch(ch){

            case 'c':
                {
             system("cls");
            void DisplayDryCleaningservices();

              printf("Which item is your choice   ? "); scanf("%d",&i1);


             double price1;
             double price11;
              switch(i1){

              case 1 :
               price1 = 20 ;
              break;

              case 2:
              price1 = 10 ;
              break;

              case 3:
              price1 = 15 ;
              break;

              case 4:
              price1 = 15;
              break;

              case 5:
              price1 = 15;
              break;

              case 6:
              price1 = 20;
              break;

              default:
               printf("enter wrong number ");

             }

           printf("how many kilogram is your item ? ");scanf("%d",&w1);
             price11 = price1 * w1;
             prices.push_back(price11);
             weight.push_back(w1);
             printf("press  'b' to BACK\n");
             break;
             {
            case 'b':
                {
             int s = 1 ;
             system("cls");
             void DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }




    break;
         }
/****************************************************************
   case 2 : Hand    Wash   services
****************************************************************/

       case '2':
           {
       bool  i1,j1;

        int   i2,j2 ;
        int w ;
        w = 0 ;

        char choq;

      void Displayhandwashservices();

        printf("press 'c' to continue 'b' to BACK\n");
       while(!w){

          scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");
             void Displayhandwashservices();


             printf("Which item is your choice   ? ") ;scanf("%d",&i2);
;


             double price2;
             double price22;
             switch(i2){

              case 1 :
               price2 = 5 ;
              break;


              default:
               printf("enter wrong number ");

             }



              printf("how many kilogram is your  item? ") ;scanf("%d",&w2);
;
             price22 = price2 * w2 ;
             prices.push_back(price22);
             weight.push_back(w2);

             printf( "press  'b' to BACK\n");
             break;

            case 'b':
             w = 1 ;
             system("cls");
             DisplayMenu();
            break;
            default:
             printf("enter wrong choice ...!\n");
         }
    }

      break;
           }
/****************************************************************
   case 3 : General Washing  Services
****************************************************************/

       case '3':
           {
       bool  i11;
       int   i21 ;
       int  r ;
       r = 0 ;

       char choq1;

       void DisplayGeneralWashingServices();

        printf("press 'c' to continue 'b' to BACK\n");
       while(!r){

           scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");

             void DisplayGeneralWashingServices();


              printf("Which item is your choice   ? ");scanf("%d",&i3);
;


             double price3;
             double price33;
             switch(i3){

              case 1 :
               price3 = 10 ;
              break;

              case 2:
              price3 = 8 ;
              break;

              case 3:
              price3 = 11 ;
              break;

              case 4:
              price3 = 15;
              break;

              case 5:
              price3 = 9;
              break;

              case 6:
              price3 = 10;
              break;

              default:
               printf("enter wrong number ");

             }



             printf("how many kilo gram are your ? ") ;scanf("%d",&i3);
;
             price33 = price3 * w3 ;
             prices.push_back(price33);
             weight.push_back(w3);

             printf( "press  'b' to BACK\n");
             break;

            case 'b':
             r = 1 ;
             system("cls");
             DisplayMenu();
            break;
            default:
             printf("enter wrong choice ...!\n");
         }
    }




       break;
           }
/****************************************************************
   case 4 :Ironing  Services
****************************************************************/
       case '4':
           {
         int z;

         z = 0;

         char choi;

         char  x[20] ;

         void DisplayIroningServices();

          printf("press 'c' to continue 'b' to BACK\n");

          while(!z){

           scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");
            void DisplayIroningServices();


             printf("Which item is your choice   ? ") ;scanf("%d",&i4);
;


             double price4;
             double price44;
             switch(i4){

              case 1 :
               price4 = 1 ;
              break;

              case 2:
              price4 = 0.8 ;
              break;

              case 3:
              price4 = 1.2 ;
              break;

              case 4:
              price4 = 3 ;
              break;

              case 5:
              price4 = 4;
              break;

              default:
               printf("enter wrong number ");

             }



             printf("how many kilo gram are your ? " );scanf("%d",&w4);
;
             price44 = price4 * w4;
             prices.push_back(price44);
             weight.push_back(w4);

             printf("press  'b' to BACK\n");


             break;

            case 'b':
             z = 1 ;
             system("cls");
             DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }




       break;
           }
/****************************************************************
   case 5 :Clothes Mending  Services
****************************************************************/

       case '5':
           {
         char cho;
         int f;
         f = 0 ;
         void Displayclothesmendingservices();

          printf("press 'c' to continue 'b' to BACK\n");
         while(!f){

           scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");
             void Displayclothesmendingservices();


             printf ("Which item is your choice   ? ") ;scanf("%d",&i5);
;


             double price5;
             double price55;
             switch(i5){

              case 1 :
               price5 = 3.5 ;
              break;


              default:
               printf("enter wrong number ");

             }


             printf("how many kilo gram are your ? " );scanf("%d",&w5);
;
             price55 = price5 * w5 ;
             prices.push_back(price5);
             weight.push_back(w5);

             printf("press  'b' to BACK\n");

             break;

            case 'b':
             f = 1 ;
             system("cls");
             DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }
    break;
           }
/****************************************************************
   case 6 :Stain  Removing  Service
****************************************************************/
     case '6':
         {
        void DisplayStainRemovingServices();

        int  y ;

        y = 0 ;

         char cho3 ;


           printf("press 'c' to continue 'b' to BACK\n");

           while(!y){

           scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");
             void DisplayStainRemovingServices();


            printf("Which item is your choice   ? ") ;scanf("%d",&i6);
;


             double price6;
             double price66;
             switch(i6){

              case 1 :
               price6 = 5 ;
              break;

              case 2:
              price6 = 3 ;
              break;

              case 3:
              price6 = 2 ;
              break;



              default:
               printf("enter wrong number ");

             }



             printf("how many kilo gram are your ? ") ;scanf("%d",&w6);
;
             price66 = price6 * w6 ;
             prices.push_back(price6);
             weight.push_back(w6);

             printf("press  'b' to BACK\n");

             break;

            case 'b':
             y = 1 ;
             system("cls");
             DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }
break;
         }
/****************************************************************
   case 7 :Costumer Receipt
****************************************************************/
     case '7':
         {
        void DisplayCostumerReceipt();

        int  o ;

        o = 0 ;

         char cho33 ;


           printf("press 'c' to continue 'b' to BACK\n");

           while(!o){

           scanf("%d",&ch);

           switch(ch){

            case 'c':

             system("cls");
             void DisplayCostumerReceipt();
             printf("press  'b' to BACK\n");
             printf("\n");

             totalprice = prices[0] +prices[1]+prices[2]+prices[3]+prices[4]+prices[5];

             printf ("Total price is  :>  " );
             printf(totalprice);
             printf(" RM" );

             totalweight = weight[0]+weight[1]+weight[2]+weight[3]+weight[4]+weight[5];

             printf("Total weight is :>  ");printf(totalweight);

             break;

            case 'b':
             o = 1 ;
             system("cls");
             DisplayMenu();
            break;
            default:
            printf("enter wrong choice ...!\n");
         }
    }

        break;

         }
/****************************************************************
   case 8 :Exit
****************************************************************/
       case '0':
           {
          done = 1 ;
       break;

       default:
       printf("Enter wrong choice ..!! \n");
       printf("try it again ...\n");
           }
  }  // switch
 } // while
return 0;
}//main

Thanks for your reply.
Actually i don't know what should i do with push_back! is there any replace things for push_back?!
Thanks

yes, it means you haveto write your own vector,list
or write it to an end of array

When working with arrays you need to have a counter that indicates how many valid items are in the array. If it's a dynamic array, such as one allocated with malloc(), you also need another counter (int) that indicates the current number of elements in the array. When you want to add another item (e.g. push_back) you need to check if the array needs to be expanded by comparing those two integers I just mentioned. If the array isn';t large enough you have two options: 1) ignore the new item, e.g. discard it, or 2) call realloc() to expand the array. Only arrays allocated with malloc() to begin with can be expanded like that.

As you can see, c++ vector class has saved you a whole lot of coding over the C counterpart (arrays). I like to put all that stuff in another function so that the main part of the program doesn't get so messy and difficult to read/maintain.

you might use my stack for examle it should work

#include <stdio.h>
#include <stdlib.h>

#define ER_EMPTY_STACK -1

#define MSG_EMPTY_STACK "Stack is Empty\n"
#define LOG_ENABLED
struct stElem
{
   int iData;
   stElem *stNext;
};

stElem *stStartPtr = NULL;

int iPrintList()
{
   stElem *stCurrent;
   stCurrent = stStartPtr;
   int iElementCount = 1;
   while(stCurrent != NULL)
   {
      printf("#%d [%d] ",iElementCount ,stCurrent->iData);
      stCurrent = stCurrent->stNext;
      iElementCount++;   
   }
   if(iElementCount != 1 )
   {
      printf("\n");
   }
   printf("Total of elements [%d]\n",iElementCount - 1);   
   return iElementCount - 1; 
}

int iPop()
{
   int iSavedData = ER_EMPTY_STACK;
   stElem *stTmp = NULL;
   if(stStartPtr != NULL)
   {
      iSavedData = stStartPtr->iData;
      #ifdef LOG_ENABLED
      printf("Pop [%d]\n", iSavedData);
      #endif
      stTmp = stStartPtr;
      stStartPtr = stStartPtr->stNext;
      free(stTmp);
   }
   else
   {
      iSavedData = ER_EMPTY_STACK;
      printf(MSG_EMPTY_STACK);
   }
   return iSavedData;
}
int iPush(int iData)
{
   stElem *stTmp = NULL;

   if(stStartPtr == NULL)
   {
      stStartPtr = (stElem*)malloc(sizeof(stElem));
      stStartPtr->stNext = NULL;
      stStartPtr->iData = iData;
      #ifdef LOG_ENABLED
      printf("Push to empty stack [%d]\n", stStartPtr->iData );
      #endif
   }
   else
   {
      stTmp = (stElem*)malloc(sizeof(stElem));
      stTmp->iData = iData;
      stTmp->stNext = stStartPtr;
      stStartPtr = stTmp;
      #ifdef LOG_ENABLED
      printf("Push [%d]\n", stTmp->iData);
      #endif
   }

   return 0;
}

void vLinkedListProgram()
{
   int iCounter = 50000;
   printf("Press to allocate");
   getchar();
   while(iCounter-- > 0 && iPush(iCounter) == 0); 
   printf("Press to free");
   getchar();
   while(iPop() != ER_EMPTY_STACK);

   /*iPop();
   iPop();
   iPop();
   iPush(888);
   iPush(999);
   iPrintList();
   iPop();
   iPop();
   iPrintList();*/
}

int main()
{

   while(1)
   {
      vLinkedListProgram();
   }
    return 0;
}

Does 'printf' still work with c++ ? I thot 'cout' in dev and turbo c++ and std :: cout for vc++ . Though printf does work in turbo and dev c++ ...

Does 'printf' still work with c++ ?

Yes. C++ supports almost everything in C.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.