| The Following User Says Thank You to demolition For This Useful Post: | ||
|
|
2011-06-16
, 13:16
|
|
|
Posts: 1,102 |
Thanked: 368 times |
Joined on Oct 2010
@ india, indore
|
#22
|
after it compiles without error, you have to make the resulting file (a.out is default) executable by "chmod +x a.out". this has to be done in a folder which supports this flag, MyDocs is a FAT filesystem which does NOT support it.
copy it to /home/user f.ex., then use chmod +x.
|
|
2011-06-16
, 13:27
|
|
|
Posts: 850 |
Thanked: 626 times |
Joined on Sep 2009
@ Vienna, Austria
|
#23
|
since i am very very new in coding so i want to know what to type in xterminal after this (see image)
chmod +x a.out
./a.out
| The Following 2 Users Say Thank You to SubCore For This Useful Post: | ||
|
|
2011-06-16
, 13:32
|
|
|
Posts: 1,102 |
Thanked: 368 times |
Joined on Oct 2010
@ india, indore
|
#24
|
since you have a.out in /home/user, which is a proper linux filesystem (ext2), type
to make it executable. then you can run it byCode:chmod +x a.out
note the ./ at the beginning, this tells your shell to look in the current directory (which, contrary to windows systems, is NOT part of the $PATH variable).Code:./a.out
| The Following User Says Thank You to nicholes For This Useful Post: | ||
|
|
2011-06-16
, 13:54
|
|
|
Posts: 298 |
Thanked: 341 times |
Joined on Aug 2010
@ This world :)
|
#25
|
: Python Gorillas (Maemo5)
Faircrack0.50 Update (Maemo5) 
: WPScrack (Maemo5)
|
|
2011-06-16
, 14:44
|
|
Posts: 560 |
Thanked: 422 times |
Joined on Mar 2011
|
#26
|
Not being a real C or C++ programmer, should the logic of the program not be something like:
While no user input -> Hello World.
|
|
2011-06-16
, 18:12
|
|
|
Posts: 298 |
Thanked: 341 times |
Joined on Aug 2010
@ This world :)
|
#27
|
No. The sole purpose of this programme is to produce an output i.e. "hello, world". Nothing else. The only user input should be to run the programme, that's it. The slight glitch can be that the console disappears so fast the output cannot be read hence my alternate version, which does require user input.
The entry point of a C++ programme is main(), or pseudo-name thereof. The first command in main(), for this programme, is to stream a string to the standard output (console). The next is to return i.e. to end.
In more complex programmes one might want {while(no user input){action}}, but here it's really simple. The other reason for saying No is in C++ while is a loop, so your logic would produce many, many "hello, world" s. However, only one is required.

: Python Gorillas (Maemo5)
Faircrack0.50 Update (Maemo5) 
: WPScrack (Maemo5)
|
|
2011-06-17
, 09:24
|
|
|
Posts: 1,102 |
Thanked: 368 times |
Joined on Oct 2010
@ india, indore
|
#28
|
ause not found comes!! Any way to get rid of it
|
|
2011-06-17
, 10:00
|
|
Posts: 560 |
Thanked: 422 times |
Joined on Mar 2011
|
#29
|
|
|
2011-06-17
, 10:48
|
|
|
Posts: 302 |
Thanked: 193 times |
Joined on Oct 2008
@ England
|
#30
|
| The Following User Says Thank You to Captwheeto For This Useful Post: | ||
![]() |
| Tags |
| i am sleeping |
| Thread Tools | |
|
These will work.
Simple way (but might not be visible)
#include <iostream> // use correct i.e. C++ library int main() // declare f'n name & return type { using namespace std; // do this inside scope cout << "hello, world"; // self-terminating string cout << endl; // output a line end return 0; // return an int - quit programme }#include <iostream> // use correct i.e. C++ library int main() // declare f'n name & return type { using namespace std; // do this inside scope cout << "hello, world"; // self-terminating string cout << endl; // output a line end // get console to wait for user input... cout << "Press any letter then [Enter]"; cout << std::endl; // end line after user instruction char ch; // temporary variable cin >> ch; // store letter cout << ch; // do something with it return 0; // return an int - quit programme }