62 558
Assignments Done
98,8%
Successfully Done
In June 2018

Answer to Question #21682 in C++ for patrick

Question #21682
how do i write a program that outputs the contact number from a selected person from a list of 46 people?
Expert's answer
#include <iostream>
#include <string>

#include <conio.h>

using namespace std;

struct people{
public:
int id;
string name;
string telephone;
};


int main()
{
int id;
people p[46];
p[0].id=1;
p[0].name="Peter";
p[0].telephone="123123123";
p[1].id=2;
p[1].name="John";
p[1].telephone="434323123";
p[2].id=3;
p[2].name="Bred";
p[2].telephone="43423123123";
cout<<"Enter id people: ";
cin>>id;
for(int i=0;i<3;i++){
if(id==p[i].id){
cout<<p[i].id<<" "<<p[i].name<<"
"<<p[i].telephone;
}
}
getch();
return 0;
}


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