c program program need to solve- C program by considering the following steps:
1. The program reads names (first name and last na me) from the input and saves in an array.
2. The program stops reading names from the input when enter ‘X’ or ‘x’.
3. Then, read a first name from the input and search in the array.
4. If the first name is found, the program prints the last name.
5. If the first name is not found, the program prints “The name is not found”.
The program I type that can take input but don't know how to find the last names when i will give input first name as first . Can anyone help me please.
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(){
char first[10][10], last[10][10],a,m[10][10],n[10];
int i,j;
if(first[i]!='x')
for(i=0; i<10;i++)
{
printf("Enter the first name: ");
scanf("%s", &first[i]);
printf("Enter the last name: ");
scanf("%s", &last[i]);
if(first[i]=='x' || last[i]=='x')
{
printf("please enter the first name for search:\n");
scanf("%s", first[i]);
if(first[i]==first[i]){
printf("ur last name is: %s", last[i]);}
}
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire