简单的c ++程序没有输出.. [英] SImple c++ program with no output..

查看:56
本文介绍了简单的c ++程序没有输出..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是所有新手到C ++的简单程序。


我是新手。


i install cygwin并使用g ++ ,我编译没有问题,但程序没有输出。

一旦我成功编译它,命令只是在我运行程序之前跳出来。


但我尝试另一种方式来运行程序,它可以显示输出:


$ ./testing

Hello C ++ World!

$



这里是testing.cpp文件

here is the simple program for all the newbie to C++.

i''m a newbie.

i install cygwin and use g++, i compiled it no problems, but there is no output for the program.
once i compiled it successfully, command just jump out before i run the program.

But i try the other way to run the program and it can display the output :

$ ./testing
Hello C++ World!
$


here is the testing.cpp file

展开 | 选择 | Wrap | 行号

推荐答案

./ testing

Hello C ++ World!
./testing
Hello C++ World!






这里是testing.cpp文件



here is the testing.cpp file
展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


你需要输出一个新行,因为stdout没有要求显示任何字符,直到它看到一个新行或者流被刷新

You need to output a new line because there is no requirement on stdout to display any characters until it sees a new line or the stream is flushed

展开 | 选择 | Wrap | 行号


这篇关于简单的c ++程序没有输出..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆