#include <iostream>
#include <time.h>
#include <string.h>
#include <stdio.h>
int main()
{
string msg;
printf("Enter the message that you wish to display as scroller: ");
getline(cin,msg);
msg=msg+". ";
int x=0;
while(1)
{
Scroll(msg);
wait(100);
system("cls");
x++;
}
cin.get();
return 0;
}
我有这个C代码和文件中的所有字符串说‘标识符“字符串”是未定义的’。 我尝试包含
而不是
,但没有工作。 为什么不起作用?
添加
using namespace std;
在includes之后(但在main之前)。 或者,更好地使用以下概念:
std::string // instead of string
更新:我错过了这个问题的意义。 我会留下这个答案,但是为了正式起见,如果你来自谷歌,并且你在用C++工作,请使用它。
这是C++代码,不是C。
编译器很可能因为无法解析它而变得迷惑,所以然后它发现类似C的代码,并且所有标识符都不存在。
所包括的内容应为:
#include <iostream>
#include <ctime>
#include <string>
#include <cstdio>
您还缺少一个:
using namespace std;
加上滚动
和等待
等的定义。