60 696
Assignments Done
97,8%
Successfully Done
In April 2018

Answer to Question #16434 in C++ for arif hussain

Question #16434
Q#2 • Write a program that defines the structure "part", having three members: Model number (int) Part number (int) Cost (float) Assign the value to the members of the structure. Define two structure variables part1 and part2. Initialize part1, print out the values of its members, assign part1 to part2, and print out is members.
Expert's answer
#include<iostream>
using namespace std;

struct part{
int mod_num, part_num;
float cost;
} part1, part2;

void main(){
cout<<"enter the model number: ";
cin>>part1.mod_num;
cout<<"enter the part number: ";
cin>>part1.part_num;
cout<<"enter the cost: ";
cin>>part1.cost;
part2 = part1;
cout<<part2.mod_num<<" "<<part2.part_num<<" "<<part2.cost<<"\n";
system("pause");
}





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions