2013-01-08T10:45:16-05:00
how do i write a program that outputs the contact number from a selected person from a list of 46 people?
1
2013-01-09T08:55:50-0500
#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 !
Learn more about our help with Assignments:
C++
Comments