#include "stdio.h"
void getWords(int n){
char s[]="Word,Excel,Powerpiint,Outlook,Access,InfoPath,Publisher,Sharepoint";
int i,k;
for(k=i=0;s[i];k+=s[i++]==',');//统计s里有几个逗号
if(n==1)
i=-1;
else if(k printf("Error!\n"); return; } else for(n--,k=i=0;(k+=s[i]==',') for(i++;s[i]!=',' && s[i];printf("%c",s[i++])); printf("\n"); } int main(int argc,char *argv[]){ int n; printf("Please enter n(int 0 scanf("%d",&n); getWords(n); return 0; } 代码格式和运行样例图片:
且不说你的图糊的跟鬼一样,你这个态度像是请教吗,自己做