作者ric2k1 (Ric)
看板EE_DSnP
标题[情报] HW#1 Q & A
时间Sat Sep 29 21:17:15 2007
=======================
我是用Dev C++. 然後像是作业第2题我complie过後执行, 他会跑出一个dos 介面, 如题
目叫我输入两个integer, 但是我输入之後, 按下Enter之後, 确没有跑出”the sum is”
这个答案, 而且那个dos视窗也自己关掉了. 然後我自己也尝试写一段从课本里的一段程
式, 结果还是一样, 虽然有显示出要user输入的那个画面, 但是输入完毕按enter之後,
整个介面就消失了.请问是我用的软体有问题吗?
>>>
you can add a line
system(“pause”);
just before “return 0;”
Or there may be some options for DevC++, but I don’t know.
Or open a dos window first, and then execute the program by typing the program
name.
============================
作业的第三题, 请问”shortest”的意思是什麽? 是需要cout出来一些东西? 还是只要写
出程式码就好了呢?
>>>
The problem 3 is to write a “shortest program”, meaning the source code
itself is shortest. Nothing to do with cout.
============================
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.128.24
1F:推 nomadone:还是不太懂第三题的意思 是要写出可以跑的程式 又要程式 09/29 21:28
2F:→ nomadone:码是最短的?! 09/29 21:29
3F:→ nomadone:还有第五题的"platform independent"是说JAVA可以在不同 09/29 21:30
4F:→ nomadone:的平台下执行吗? 09/29 21:32
5F:推 DoraBoy:我也搞不清楚第三题的意思~如果要shortest 那可以写一个没 09/29 22:12
6F:→ DoraBoy:有内容(只有架构) 的程式吗 09/29 22:13
7F:推 ric2k1:是的 可以跑且compile不会有error & warning 的程式 09/29 23:45
8F:→ ric2k1:[Hint] 空格也算是一个字元喔 09/29 23:51
9F:推 ric2k1:Yes. "platform independent" = 可以在不同平台下执行 09/29 23:52
10F:推 oops750513:可以了...加了system(pause)就行了...谢谢 09/30 21:57