Question: Write C++ program that contains two structs as follow: - Struct name ShoeType that contain three members: style price - adate Style for the shoe
Write C++ program that contains two structs as follow:
- Struct name ShoeType that contain three members: style price - adate
Style for the shoe style - Price for its prices - adate for arrival date
- Struct name date that contain three members: year month - day
The program contains three functions
void readShoeRecord(ShoeType& newShoe);
ShoeType discount(ShoeType oldRecord);
void printShoeRecord(ShoeType newShoe);
The first function fills newShoe with values read from the keyboard.
The second function returns a structure that is the same as its argument,
but with the price reduced by 10%.
The third function print newShoe information.
In the main, you will call the three functions.
this is the question and my code it is
#include
using namespace std;
struct data{
int year;
int month;
int day;
};
struct ShoeType{
string style;
double price;
data adate;
};
void readShoeRecord(ShoeType& newShoe);
ShoeType discount(ShoeType oldRecord);
void printShoeRecord(ShoeType newShoe);
int main()
{
ShoeType newShoe;
readShoeRecord(newShoe);
newShoe=discount(newShoe);
printShoeRecord(newShoe);
return 0;
}
void readShoeRecord(ShoeType& newShoe){
cout<<"Shoe stayle : ";
cin>>newShoe.style;
cout<<"price: ";
cin>>newShoe.price;
cout<<"enter the adate for shose : "<
cout<<"enter year:";
cin>>newShoe.adate.year;
cout<<"enter month:";
cin>>newShoe.adate.month;
cout<<"enter day:";
cin>>newShoe.adate.day;
}
ShoeType discount(ShoeType oldRecord){
oldRecord.price=oldRecord.price-(oldRecord.price*0.10);
return oldRecord;
}
void printShoeRecord(ShoeType newShoe){
cout<<"shose style : "<
cout<<"shose price: "<
cout<<"the adate for shose : "<
}
it is good ??
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
