2019-8-11 新知识

原文链接: http://www.cnblogs.com/FirwoodLin/p/11336923.html

对于int类型的数字n

  1. n/10

    表示去掉个位数 同时n总位数减一
    (e.g.6789/10=678)
  2. n%10

    表示获取n的个位数
  3. 利用这两个式子可以进行数字反转等


读入字符串(含空格)

cstdio库的gets函数

#include 
#include 
using namespace std;
int main ()
{
    char a[1000];
    for(int i=1;i<=1000;i++)
    {
        gets(a);
        cout<

最大一千个字符的复读机示例

转载于:https://www.cnblogs.com/FirwoodLin/p/11336923.html

你可能感兴趣的:(2019-8-11 新知识)