获取您
自己的
网站
×
更改方向
更改主题,深色/浅色
前往 Spaces
#include <stdio.h> int main() { // Create an int and a char variable int myNum; char myChar; // Ask the user to type a number AND a character printf("Type a number AND a character and press enter: \n"); // Get and save the number AND character the user types scanf("%d %c", &myNum, &myChar); // Print the number printf("Your number is: %d\n", myNum); // Print the character printf("Your character is: %c\n", myChar); return 0; }
输入一个数字和一个字符,然后按回车键: 5b
您的数字是: 5
您的字符是: b