c語言數組輸入char
發布時間: 2022-12-22 21:18:19
『壹』 c語言char型輸入輸出問題
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main(void)
{
int a, b, c;
char x, y, z;
scanf("%d%d%d", &a, &b, &c);
printf("%d%d%d\n", a, b, c);
scanf("\n%c%c%c", &x, &y, &z);////這樣之後看看,,,,,因為在輸入流中"\n"被按照字元讀入了。
printf("%c %c %c\n", x, y, z);
getch();
return 0;
}
『貳』 C語言中char的用法
#include<stdio。h>
intmain()
{
inti;
charc;//定義一個char類型的變數。
c='a';//賦值
for(i=0;i<26;i++){
printf(「%c」,c);//輸出一個字元用%c,
c++;//charc增加1,依次可以得到:abcdef。。。。z
}
printf(「 」);
if(c<='z')
printf(「stillasmallletter。 」);
else
printf(「Notasmallletter。 」);
scanf(「%c」,&c);//輸入一個字元到c中。
charstr[10]=「AString」;//定義一個字元數組,它的初值是「AString」
for(i=0;str[i]!='