c 的小问题想改成这种形式(java 会做 c 就.)例如:please input your name (你输入的名字) please input your age (你输入的年龄)然后打印出: Hello,(你输入的名字,(名字手写字母大写)) (几
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 19:48:27
c 的小问题想改成这种形式(java 会做 c 就.)例如:please input your name (你输入的名字) please input your age (你输入的年龄)然后打印出: Hello,(你输入的名字,(名字手写字母大写)) (几
c 的小问题
想改成这种形式(java 会做 c 就.)
例如:please input your name
(你输入的名字)
please input your age
(你输入的年龄)
然后打印出:
Hello,(你输入的名字,(名字手写字母大写))
(几个Vowels 在你的名字里)
(你年龄(X)是odd/even)
#include
#include
struct student{
char array[999];
int age;
};
typedef struct student student;
void main(){
student *current;
char curr;
int i=0;
int j=0;
current =(student *) malloc (sizeof(student));
printf("please input your name\n");
while ((curr=getchar())!='\n')
current->array[i++]=curr;
current->array[i]='\0';
current->array[0]=toupper(current->array[0]);
printf("Hello,");
j=0;
for ( i=0;current->array[i]!='\0';i++){
printf("%c",current->array[i]);
if (current->array[i] == 'a' || current->array[i] =='A'
||current->array[i] == 'e'||current->array[i] == 'E'
||current->array[i] == 'i' ||current->array[i] == 'I'
||current->array[i] == 'o'||current->array[i] == 'O'
||current->array[i] == 'u'||current->array[i] == 'U')
j = j+1;
}
printf("!\n");
printf("%d vowels in your name.\n",j);
printf("pleae input your age\n");
scanf("%d",¤t->age);
if(current->age%2==0){
printf("your age (%d) is even\n",current->age);
}
else{
printf("your age (%d) is odd\n",current->age);
}
free(current);
}
c 的小问题想改成这种形式(java 会做 c 就.)例如:please input your name (你输入的名字) please input your age (你输入的年龄)然后打印出: Hello,(你输入的名字,(名字手写字母大写)) (几
what's wrong?
I don't know what you said.
Please write your problem!
想改成这种形式(java 会做 c 就.)
例如:please input your name
(你输入的名字)
please input your age
(你输入的年龄)
然后打印出:
Hello,(你输入的名字,(名字手写字母大写))
(几个Vowels 在你的名字里)
(你年龄(X)是odd/even)
#include
#include
struct student{
char array[999];
int age;
};
typedef struct student student;
void main(){
student *current;
char curr;
int i=0;
int j=0;
current =(student *) malloc (sizeof(student));
printf("please input your name\n");
while ((curr=getchar())!='\n')
current->array[i++]=curr;
current->array[i]='\0';
current->array[0]=toupper(current->array[0]);
printf("Hello,");
j=0;
for ( i=0;current->array[i]!='\0';i++){
printf("%c",current->array[i]);
if (current->array[i] == 'a' || current->array[i] =='A'
||current->array[i] == 'e'||current->array[i] == 'E'
||current->array[i] == 'i' ||current->array[i] == 'I'
||current->array[i] == 'o'||current->array[i] == 'O'
||current->array[i] == 'u'||current->array[i] == 'U')
j = j+1;
}
printf("!\n");
printf("%d vowels in your name.\n",j);
printf("pleae input your age\n");
scanf("%d",¤t->age);
if(current->age%2==0){
printf("your age (%d) is even\n",current->age);
}
else{
printf("your age (%d) is odd\n",current->age);
}
free(current);
}
what?
that's right?