Type the Question

Thursday, February 21, 2019

Question Name:Address

#include <iostream>
#include <string.h>
using namespace std;
class tech
{ public:
  char name[200],place[100];
 char no[20];
} ob[10];

int main()
{
int n,flag=0;
  char abc[80];
  cin>>n;
  for(int i=0;i<n;i++)
  {
    cin>>ob[i].name>>ob[i].no>>ob[i].place;
    
  } 
  cin>>abc;
  for(int i=0;i<n;i++)
  {if(strcmp(abc,ob[i].name)==0)
  {cout<<"Name Mobile Number City\n"<<ob[i].name<<" "<<ob[i].no<<" "<<ob[i].place;
 flag=1;
   break;
  } 
  }
   if(flag==0)
     cout<<"The Entered Name is not in the Directory";
   return 0;
}
  • Problem Description
    You have to find the address and mobile number of the employee in the company you have to go through employee details register and find his/her mobile number
  • Test Case 1
    Input (stdin)2
    Williams
    9851552422
    Chennai
    Milton
    9532452525
    Chennai

    Williams

    Expected OutputName Mobile Number City
    Williams 9851552422 Chennai
  • Test Case 2
    Input (stdin)2
    Williams
    9851552422
    Chennai
    Milton
    9532452525
    Chennai

    Jothi
    Expected OutputThe Entered Name is not in the Directory

No comments:

Post a Comment

Question Name:TOWER OF HANOI

#include < bits / stdc ++. h > #define lli long long using namespace std ; lli dp [ 202 ]; int main () { int t , n ; ...