菜鸟问题,为什么无输出呢?
我写了一个很简单的hello,world的程序
printf( "hello,world ");
cout < < "hello,world "
c++ -o hello hello.c编译通过了..
然后执行 hello 结果没有输出到屏幕,这是为什么呢?
[解决办法]
#include "iostream "
#include "stdio.h "
#include "stdlib.h "
using namespace std;
int main()
{
printf( "hello,world ");
cout < < "hello,world ";
system( "pause ");
return 0;
}
[解决办法]
编译好像没问题
有这两句呢
#include "iostream "
using namespace std;
没输出吗?
我怎么运行有输出?
我用的DEV-C++ 4.9.9.2
[解决办法]
// hello.cpp 存成cpp文件
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
printf( "Hello, world\n ");
cout < < "Hello, world " < < endl;
return 0;
}
编译
g++ -o hello hello.cpp
运行
./hello
[解决办法]
有这么麻烦吗?不如直接一点啦。
#include <stdio.h>
void main(){
printf( "hello world\n ");
}
这样不就OK了吗?
[解决办法]
LZ用的是什么编译器啊?
上面几位写的程序都可以编译且输出的啊。。。
请检查编译器是否有问题。。。