First Line: Alt+Enter
First Line: Alt+Enter
2. Folder settings:
Let your TC compiler is stored in D drive. Hence following are the paths:
include folder path- d:\tc\include
lib folder path- d:\tc\lib
output folder path- d:\tc\output
source folder path- d:\tc\src
Steps:
1. Bring the TC.EXE from d:\tc\bin to desktop by right clicking it. Double click
it to starts the turbo IDE. Press Alt+Enter
2. Click the Option menu tab.
3. Click the Directories . . . from pull-down menu.
4. Change the paths as stated above; and press OK
5. Click the Option menu tab again.
6. Click the Save . . . from pull-down menu.
7. Click OK to save the changed configuration.
Now you are ready to prepare the first program. Follows the below given steps now:
1. Click on File > Open
2. Write the file name in Name: d:\tc\src\sum.c. Press open. Your file will be
made in the src folder.
3. Type the following program:
//sum.c : program to add two numbers 4. Click File>Save or F2
#include <stdio.h> 5. Click Compile>Compile or Alt+F9
#include <conio.h> If there is any grammatical error,
void main() { correct it and then recompile it till all
int a, b, sum; errors are removed.
6. Click Run>run or Ctrl+F9.
clrscr(); 7. Enter two numbers separated with
printf("Enter two numbers: "); space; for example: 10 20
scanf("%d%d", &a, &b); 9. Press Enter key on the keyboard. You
will get the result:
sum = a + b; The sum is: 30.
10. Press any key. Close the existing
printf("The sum is: %d", sum); program and prepare another by
getch(); following same steps.
}
r
Some useful commands (hot keys):
F1 details of error & help of any menu item
Ctrl+F1 Detailed help of a reserve word or function
Alt + F9 Compilation only
Ctrl + F9 Compile and Run
Alt + F5 user / result screen
F2 Save
F9 Make “exe” file on hard disk
F3 to open a new or existing file
Your first program in C / C++ (Getting familiar with Visual Studio 6.0 IDE)
1. Prepare a folder in any drive, (say d) named as prg. It will contain program files.
2. Install Visual Studio 6.0.
3. Click start > all programs > Microsoft Visual studio6.0 > Visual Studio 6.0 C++. You
will get the
IDE opened.
4. Click File >New>Files>C++ Source File.
5. In the Location text box enter d:\prg It is the path where your program will be stored.
6. In the File name text box enter sum.c It is the program name. If extension is c, it will
be a C
program. If extension is cpp, it will be a C++ program.
7. Press OK. Type the following program.
8. Click File>Save or Ctrl+S to save
9. Click build>Compile sum.c.
//sum.c : program to add two numbers If there is any grammatical error,
#include <stdio.h> correct it and then recompile it till all
void main() { errors are removed.
int a, b, sum; 10. Click Build>Execute sum.c to run the
program
printf("Enter two numbers: "); 11.Enter two numbers separated with
scanf("%d%d", &a, &b); space; for example: 10 20
12. Press Enter key on the keyboard. You
sum = a + b; will get the result:
The sum is: 30.
printf("The sum is: %d", sum); 13. Press any key.
} 14. Click File>Close Workspace to close the
existing program and prepare another by
following same steps.
Note:
o Do not include <conio.h> in Visual Studio 6.0 IDE
o Do not use clrscr( ) and getch( ) in Visual Studio 6.0 IDE
A C++ program:
//sum.cpp : program to add two numbers
#include <iostream.h>
Prepare and run the sum.cpp
void main() { program either in turbo or in
int a, b, sum; Visual studio 6.0 in the way
explained above.
cout << "Enter two numbers: ";
cin >> a >> b; Tracing, testing and debugging
will be explained in the lectures.
sum = a + b;