小编use*_*249的帖子

C编程,Switch Case问题

#include <stdio.h>
int main(void)
{
char ch;
//character = ch        
    printf("Please type a character [A-Z or a-z] ('x'to exit):");
    scanf("%c", &ch);   
        switch(ch) //switch statement
        {
        case 'a':
            printf("%c is a vowel.\n", ch);
                break; 
        case 'e':
            printf("%c is a vowel.\n", ch);
                break; 
        case 'i':
            printf("%c is a vowel.\n", ch);
                break; 
        case 'o':
            printf("%c is a vowel.\n", ch);
                break; 
        case 'u':
            printf("%c is a vowel.\n", ch);
                break; 
        case 'A':
            printf("%c is a vowel.\n", ch);
                break; 
        case 'E':
            printf("%c is a vowel.\n", ch); …
Run Code Online (Sandbox Code Playgroud)

c switch-statement

1
推荐指数
1
解决办法
3192
查看次数

随机播放用户输入的字符串

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char rand(char x);
int main()
{
char input[80] = {0};
char rando[80] = {0};
char choice = 0;
char rando2[80] = {0};
if(strlen(input) >= 10 && strlen(input) <= 80); {
    printf("Please enter a string with 10-80 characters: ");
    scanf("%s", input);
    printf("Orginal string: %s\n", input);
    rando = my_rand(input);
    printf("New string: %s\n", rando);  }
else{
    return 0; }
printf("Would you like to shuffle this string again?(y or n): ");
scanf("%c\n", &choice);
if( choice == 'y') { …
Run Code Online (Sandbox Code Playgroud)

c random shuffle c-strings

0
推荐指数
1
解决办法
1942
查看次数

标签 统计

c ×2

c-strings ×1

random ×1

shuffle ×1

switch-statement ×1