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
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock