在我的main.cpp中,我的所有cout和cin都有错误.
/**
* Description: This program demonstrates a very basic String class. It creates
* a few String objects and sends messages to (i.e., calls methods on)
* those objects.
*
*/
//#include <iostream>
#include "mystring.h"
//using namespace std;
/* Function Prototypes */
void Display(const String &str1, const String &str2, const String &str3);
/*************************** Main Program **************************/
int main()
{
String str1, str2, str3; // Some string objects.
char s[100]; // Used for input.
// Print out their initial values...
cout << "Initial values:" << endl;
Display(str1, str2, str3);
Run Code Online (Sandbox Code Playgroud)
我的main.cpp不能改变,所以我的问题是,如何修复此错误,我需要添加到我的头文件和实现文件中?
在我的main.cpp中,我的所有cout和cin都有错误.
你只需要include <iostream>头文件,并使用std与cout和cin:
#include <iostream>
//^^
int main()
{
std::cout << "Initial values: "<< std::endl;
//^^
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11501 次 |
| 最近记录: |