7-16 组织星期信息 (10 分)

输入一个正整数repeat (0

定义一个指针数组将下面的星期信息组织起来,输入一个字符串,在表中查找,若存在,输出该字符串在表中的序号,否则输出-1。

Sunday Monday Tuesday Wednesday Thursday Friday Saturday

输入输出示例:括号内为说明,无需输入输出

输入样例 (repeat=3) :

3
Tuesday
Wednesday
year

输出样例:

3
4
-1
#include
#include
int main(){
  int n;scanf("%d",&n);
const char* season[7] ={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
char scan[10];int s[n];
for(int i=0;i

 

你可能感兴趣的:(PTA,C++,c++)