首页 > 代码库 > Identity Card(hdu2629)
Identity Card(hdu2629)
输入方式:先输入一个整型,再输入不带空格的字符串。
思考:先输入不带空格的字符串,用scanf_s()函数,遇到空格默认字符串输入停止。前提,以数组身份逐个循环输入。
#include<stdio.h> #include<iostream> #include<string.h> using namespace std; int main() { int n; char d; scanf("%d%c", &n, &d); while (n--) { char a[19]; for (int i = 0; i<19; i++) scanf("%c", &a[i]); printf("He/She is from "); if (a[0] == ‘3‘&&a[1] == ‘3‘) printf("Zhejiang,"); else if (a[0] == ‘1‘&&a[1] == ‘1‘) printf("Beijing,"); else if (a[0] == ‘7‘&&a[1] == ‘1‘) printf("Taiwan,"); else if (a[0] == ‘8‘&&a[1] == ‘1‘) printf("Hong Kong,"); else if (a[0] == ‘8‘&&a[1] == ‘2‘) printf("Macao,"); else if (a[0] == ‘5‘&&a[1] == ‘4‘) printf("Tibet,"); else if (a[0] == ‘2‘&&a[1] == ‘1‘) printf("Liaoning,"); else if (a[0] == ‘3‘&&a[1] == ‘1‘) printf("Shanghai,"); printf("and his/her birthday is on "); printf("%c%c,%c%c,%c%c%c%c", a[10], a[11], a[12], a[13], a[6], a[7], a[8], a[9]); printf(" based on the table.\n"); } }
Identity Card(hdu2629)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。