1011字符逆序-c++

资源 1011字符逆序-c++ 2023-08-27

请登录后获取

Binary

悠然国际管理

搬运工
组长
正式会员
注册
2021/04/18
消息
234
金粒
12,023.66金粒
Binary 提交新资源:

1011字符逆序-c++ - 纯纯分享,自学c++,源码在概述!

C++:
#include<iostream>
#include<string.h>
#include <string>
using namespace std;
int main()
{
    char w[100];
    cin.getline(w,100);//输入一整行包括空格
    //置换
    int start = 0;
    int end = strlen(w)-1;


    for (int temp;start<=end;)
    {
        temp = w[start];
        w[start] = w[end];
        w[end] = temp;
        start++; end--;
    }


    //输出
    int i = 0;
    for (; i < strlen(w); i++)
    {
        cout << w[i];
    }


    return 0;
}

阅读关于此资源更多信息...
 

在线会员

  • 黐心
  • TG_Yu_Luo
  • K3
  • 波旬W
  • 〆形同陌路。
  • srmg27
  • Sting
  • 耗子
  • 阿冬
  • 平 泽唯
  • Amaruq·Illaujaq
  • dody
  • Supper_Zero
  • 一个不知名的网友
后退
顶部 底部