我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

ACM题目(老是格式错误)(求c或c++解决)

图片说明

 #include<iostream>
using namespace std;
int main() {
    int cnt = 0;
    char input[105];
    while(cin>>input) {
        cnt++;
        if(cnt==1) {
            cout<<input<<endl;
        } else {
            cout<<endl<<input<<endl;
        }
    }
    return 0;
}

你可以写成char *input,然后用一个迭代变量代替循环结束条件,你这样的写法对于字符串来说是大忌

,首先, input 是数组input首元素input[0]的地址,,所以你这while循环的条件对吗 ,还有,你这输出的是地址,不是值

近期文章

  • Android与单片机通过串口通信,收不到返回数据
  • 请教:php中验证用户名和密码正确后,如何实现跳转?
  • Tomcat启动时,卡在了spring创建bean的地方,请问该怎么解决?
  • log4j是做什么用的 为什么我都没怎么用过 还是说spring框架后台已经用了log4j
  • leetcode第二题 add two number
  • Conformity
  • Once Around the Lock
  • A计划
  • //顺序存储结构下线性表La的逆序(int)
  • 怎么自动获取一个表中的对应值到另一个表?
  • 求助,表单引用jQuery后显示出问题
  • The Stable Marriage Problem
  • 我用eclipse启动tomcat服务器报错了,百度找不到方法
  • The shortest path
  • 有关 基础数据结构 的问题
  • God's Birthday
  • 栈 数据结构 四则运算
  • 谁帮我改下怎样才能整除?
  • spring整合RabbitMQ,启动项目后不自动接收消息,访问任意页面后才自动接收消息。
  • 输入localhost:8080无法访问

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华