HW3_4

//用getchar读入两个字符给c1,c2,然后用putchar、cout
//输出这两个字符和其ASCII码
#include<iostream>
#include<stdio.h>
#include<cstring>

using namespace std;

int main()
{
    int c1,c2;
    c1=getchar();
    getchar();
    c2=getchar();
    getchar();
    cout<<"Using Putchar To Output"<<endl;
    putchar(c1);
    putchar('\n');
    putchar(c2);
    putchar('\n');
    cout<<"The ASCII Of Them:"<<endl;
    putchar(c1);
    cout<<"->ASCII:"<<c1<<endl;
    putchar(c2);
    cout<<"->ASCII:"<<c2<<endl;
    cout<<"Using Cout To Output"<<endl;
    cout<<char(c1)<<endl<<char(c2)<<endl;
    return 0;
}

你可能感兴趣的:(HW3_4)