getoutdo 2015-06-22 00:57 采纳率: 0%
浏览 2068

c++问题 指向字符串的指针

#include "stdafx.h"
#include
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char *s = "Hello";
char *t = "World";
int i = strcmp(s, t);
if (i > 0)
cout << "s>t" << endl;
else if (i < 0)
cout << "s<t" << endl;
else
cout << "s=t" << endl;
int j = strlen(s);
cout << endl;
cout << "字符串s的长度为:" << j << endl;
return 0;
}
Error 2 error C2001: newline in constant 22 1

Error 3 error C2143: syntax error : missing ';' before 'return' 23 1
Warning 1 warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss

求高手改错,不胜感激!

  • 写回答

5条回答

  • 鹿可语 2015-06-22 01:34
    关注

    没问题可以运行,你的头文件不是故意漏掉的吧

    评论

报告相同问题?

悬赏问题

  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划