周日班 1030 cpp 笔记
第12 课 求商取余 操作
交换一个两位数的个位与十位数
#include <iostream>#include <cstdio>using namespace std;int main(){int num = 80; // 8 08 回文数 12321 12344321 reverse()int gw = num % 10;int sw = num / 10;cout << gw * 10 + sw << endl;return 0;}
方法二:
#include <iostream>using namespace std;int main(){char sw ,gw ;cin >> sw >> gw ;cout << gw >> sw;return 0;}
字符与Ascii
#include <iostream>using namespace std;int main(){// char ch = 'A';// ch += 1;// cout << ch;// A1 , B , 66int ch = 'A';ch += 1;cout << ch;// 输出结果由 容器(变量 ch)类型决定return 0;}
