003.產生輸入字元相對應之 ASCII 碼
原作者:sleader
原作者:ciwx
原作者:tong
原發表者:kyoyen
原發表者:andyeric
原發表者:kulisa
原作者:sleader
#include <stdio.h>
int main()
{
char c;
printf("Enter a character: ");
scanf("%c",&c);
printf("ASCII code for %c is %d\n",c,c);
return 0;
}
原作者:ciwx
#include <iostream.h>
void main(void)
{
char c;
cin >> c;
cout << int(c);
}
原作者:tong
#include <stdio.h>
void main()
{
char chr;
printf(\"請輸入一個字元\n\");
scanf(\"%c\",&chr);
printf(\"%c的對應ASCII碼為'%d'\",chr,chr);
}
原發表者:kyoyen
//3.產生輸入字元相對應之 ASCII 碼。
//compiled by Borland C++ Builder 6
#include <iostream>
using namespace std;
int main()
{
char code = 0;
cout << "Enter a character: ";
cin >> code;
cout << "The ASCII code of " << code
<< " is " << static_cast<int>(code) << endl;
system("pause");
return 0;
}
原發表者:andyeric
#include <stdio.h>
main()
{
char c;
scanf("%c", &c);
printf("%d\n", c);
}
原發表者:kulisa
文章標籤
全站熱搜
