Contents:
You must login to a Linux Computer. To do so you must have a login name and a password. Ask your lab administrator to provide with you with your Login and Password:
Login:rohit
Password:
The password is not shown as you type it for privacy.
Back to topOn Logging in you are presented with a shell prompt:
rohit@localhost$_
Now type vi to launch the text editor:
rohit@localhost$vi
vi is a command mode text editor:
~
~
~
~
~
:
Press i or Insert key to start typing the program.
After you finish typing, Press Esc to leave the insert mode and get back to command mode. Now give the save command :w <filename.cpp>
Now exit the vi editor by giving the quit command :q
Back to topAfter returning to the shell, compile the program using g++ compiler
rohit@localhost$g++ filename.cpp
Back to topOn compiling any errors are displayed with line numbers. On successful compilation you can move to the next section.
To edit the source code again, run the vi editor again:
rohit@localhost$vi filename.cpp
Correct the errors in the program and give the save command :w
Back to topOn successful compilation, run the program by running the output file a.out:
rohit@localhost$./a.out
./ are required to indicate that the file is in the current directory.
Back to topOnce you are satisfied with your program's functioning, you can take its output by running it again and redirecting it to a file:
rohit@localhost$./a.out >output.txt
Now the output of your program is stored in output.txt which you can print or save to a floppy.
Back to topMingW Compiler - A compiler similar to gcc; for windows | http://www.mingw.org/ |
Msys - A shell similar to linux, allowing you to practice writing an compiling programs | http://www.mingw.org/msys.shtml |
Knoppix - A Linux distro that runs off the CD without need of installation | http://www.knoppix.org/ |
Made By:
Rohit Rawat