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