0% found this document useful (0 votes)
25 views

First Line: Alt+Enter

1. The document provides instructions for creating and running a basic C program to add two numbers in two integrated development environments (IDEs): Turbo C IDE and Visual Studio 6.0 IDE. 2. It describes setting up folder structures and configuring path settings for header and library files in Turbo C IDE, and creating and saving a new source file in a specified folder location in Visual Studio 6.0 IDE. 3. Step-by-step instructions are provided for writing, compiling, and running a sample C program to add two numbers and display the result in each IDE, highlighting differences in functions and headers used.

Uploaded by

abcde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

First Line: Alt+Enter

1. The document provides instructions for creating and running a basic C program to add two numbers in two integrated development environments (IDEs): Turbo C IDE and Visual Studio 6.0 IDE. 2. It describes setting up folder structures and configuring path settings for header and library files in Turbo C IDE, and creating and saving a new source file in a specified folder location in Visual Studio 6.0 IDE. 3. Step-by-step instructions are provided for writing, compiling, and running a sample C program to add two numbers and display the result in each IDE, highlighting differences in functions and headers used.

Uploaded by

abcde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

SECTION -1

Your first program in C / C++ (Getting familiar with Turbo IDE)


1. Directory/folder structure:
TC contains following folders:
BGI: It contains the driver and other files useful for graphics.
DOC: It contains the embedded help files.
CLASSLIB: It contains standard template library for C++
EXAMPLES: It has ready made programs in C and C++.

BIN: It contains the applications, specially the TC.EXE file.


INCLUDE: It contains the header files like stdio.h, math.h etc. The header files
only contain the first line (prototype/header) of the functions supported by them.
These do not include the complete function. These files can be view in Notepad or
Wordpad.
LIB: It contains object files that have code of the functions declared in header
files. These files can not be viewed in any editor.
Prepare two more folders inside TC:
OUTPUT: It will contain temporary files like .exe, .obj etc
SRC: It will contain our programs.

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;

cout << "The sum is: " << sum;


}

You might also like