Problem D: Xiaoping checks the password

Problem D: Xiaoping checks the password

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 399  Solved: 127
[Submit][Status][Web Board]

Description

During the May Day period, Xiaoping watched too much video (video) in the laboratory every day while his younger brother was away. He suffered from amnesia and could not remember many things from the past. But Xiaoping used to have a habit of recording his passwords in various systems in a text file ping.dic, which contains the name, user name and password of each system.
The file contains several lines, the information of the first 3 lines is as follows,
ytoj 201358503114 xiaop
163 xiaoping movie
qq 944051010 Smallping

Please help Xiaoping programming to query the user name and password of the specified system.

Input

System name to query

Output

Output the user name and password of the corresponding system. If there is no system to be queried, you do not need to output any information.

Sample Input

qq

Sample Output

user 944051010
password Smallping
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
intmain()
{
    FILE *fp1,*fp2;
    char a[30],b[30],c[30],d[30];
    scanf("%s",&d);
    fp1=fopen("ping.dic","r");
    while(fscanf(fp1,"%s %s %s",&a,&b,&c)!=EOF)
    {
        if(strcmp(a,d)==0)
        {
            printf("user %s\n",b);
            printf("password %s\n",c);
            break;
        }
    }
    fclose(fp1);
    return 0;
}

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324609019&siteId=291194637