C++6.0运行后无结果显示

来源:百度知道 编辑:UC知道 时间:2024/06/08 12:32:19
// hello.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream.h>

int main(int argc, char* argv[])
{
cout<<"体会\\n和endl的应用"<<endl;
cout<<"Hello!\n";
cout<<"Hello!"<<endl;
return 0;
}
就这样一段从书上抄下来的程序,编译运行都没有错误,但是没有结果显示。如果是C++的问题,能告诉我是什么问题吗 要怎么解决

头上加个
#include <process.h>

return 0;前加个
system("pause");

C++环境
#include <iostream>
using namespace std;

int main()
{
cout<<"体会\\n和endl的应用"<<endl;
cout<<"Hello!\n";
cout<<"Hello!"<<endl;
return 0;
}

C环境
#include "stdafx.h"
#include<iostream.h>

int main(int argc, char* argv[])
{
printf("体会\\n和endl的应用\n");;
printf("Hello!\n");
printf("Hello!\n");
system("pause");
return 0;
}

看你用的是什么编译器了
如果是dev c++,可能少了头文件#include<stdlib.h>
return 前加system("pause");

改成
#include "stdafx.h"
#include<iostream>
using namespace std;
int main(int argc, char* argv[])
{
cout<<"体