NEWS & UPDATES >> BCA BCSP064 Synopsis & Project Work Started for DEC 2017, IGNOU MCA MCSP060 Synopsis Work Started for DEC 2017, CONTACT 4 IGNOU Mini Project

IGNOU BCA Study-WHAT IS SALIENT FEATURES OF C, WHAT IS C PROGRAMMING USING BORLAND COMPILER & WHAT IS RUNNING C PROGRAM USING MS-VISUAL C++



WHAT IS SALIENT FEATURES OF C

We briefly list some of C's characteristics that define the language and also have lead to its popularity as a programming language. Naturally, we studied many of these aspects throughout the MCS-011 Problem Solving and Programming course.

!      Small size











!      Extensive use of function calls















!      Structured language













!      Low level (BitWise) programming readily available

!      Pointer implementation - extensive use of pointers for memory, array, structures and functions.

!      It has high-level constructs.

!      It can handle low-level activities.

!      It produces efficient programs.

!      It can be compiled on a variety of computers.



WHAT IS C  PROGRAMMING USING BORLAND COMPILER
C using Borland C/C++ Compiler

Some of you may be using the Borland C/C++ compiler during the lab sessions under MS-DOS connecting through Windows. Whilst C++ is a different programming language to C, it is in fact a superset of C i.e. almost everything that C provides, C++ provides too, and more besides. Therefore we can use Borland C++ to compile our C programs.

To start Borland C/C++

Click the Start button in the bottom left hand corner of the screen. The Start menu pops up. Select Programs from the Start menu. Select Borland C/C++ from the

Programs menu. Select Borland C/C++ from the Borland C++ menu. In summary the steps to launching Borland C/C++ are:

Start--->Programs--->Borland C++--->Borland C++

You should now see the main window for the C/C++ development environment.

Editing a Program

We can create a program by entering text that corresponds to C statements into a file.

Setting Directories

Before you proceed, make sure that the directory settings for Borland C/C++ are correct. This can be done as follows:

Select Options from the menu and then select Project from the Options pull-down menu. This will display the Project Options dialog box. In the Topics area, click on Directories. On the right-hand side of the window you will see the Directories listed. Ensure that the information in each of the fields is as given below – if it is incorrect, modify it accordingly.

Source Directories
Include c:\ bc5\include
Library c:\ bc5\lib
Source Leave this field BLANK
Click on OK to continue.

Creating hello.c

!       Select File from the menu and then select New from the file menu. The first thing that you should do is give the program a name,       hello.c:


!      Select File from the menu


!      Select Save as from the File drop-down menu


!      In the Drives drop-down list box, click on the down arrow to open up the list box.


!      Scroll through the list to select the drive and click on it.


!      Click on the File Name: field and type hello.c


!      (Make sure the file name has the .C extension only. It should not have a .CPP extension. If it does change it to .C, or it won't run     properly)


!      Click on the OK button to continue.


!      Now type the hello.c program exactly as you wrote in the lab observation book.


!      Remember that it is good practice to save your programs periodically. You can do this as follows:


!  Select File from the menu.


Select Save from the File drop-down menu.




Compiling a Program


When you have finished typing in the program, you should compile it as follows:


Select Project from the menu


Select Compile from the project drop-down menu.

An attempt will be made to compile your program. If there are errors, they will be reported in the message window. You should use the information provided to help you fix the problems and then recompile the program.


Running a Program

If you have successfully compiled your program you can now link and run it as follows:

!      Select Debug from the menu







!      Select Run from the Debug drop-down menu.


First, an attempt will be made to link your program. If there are errors, they will be reported in the message window. You should use the information provided to help you fix the problems and then recompile and link the program.

Your program now runs. The output from the program will be displayed in a separate window. (If the screen displays a black output window for a split second and the window then disappears it means you did not set the Target Output type before you compiled your program).

To switch between the edit window and the output window, simply click on the window that you want to activate.

To close the output window, point to the icon in the top left-hand corner and double-click on it.

ALT+F9 (Short cut for Compile and Link)

As you become more familiar with the Borland C/C++ development environment, you will realize that it is possible to combine steps such as compile and link into a single step such as build all. There are also key combinations that can be used instead of selecting from menus (e.g. Alt+F9 compiles the program). You should spend some time familiarizing yourself with the Borland C/C++ development environment.

To close the hello.c file, double click on the icon in the top left-hand corner of the hello.c edit window.

To Quit from Borland C/C++ compiler

To exit from Borland C/C++:

!      Select File from the menu

!      Select Exit from the File drop-down menu

Minimum hardware requirements for Borland C/C++ Compiler

This Borland C/C++ compiler has a command line interface. You must run it from the DOS prompt. It has no Graphical User Interface like the version we use in the Labs. What you are getting for free is not a good Graphical Interface we use in the labs. You

get just the compiler, which is full spec, but you must drive it from the command line. To run the free C/C++ Compiler, your computer must meet the following 

specifications:

!       PC with a Pentium processor, 90 MHz or higher (P166 recommended)
!       Microsoft Windows 95, 98, 2000, or NT 4.0 with Service Pack 3 (or later)
!       Microsoft Internet Explorer 4.01 Service Pack 1 (included on CD ROM)
!       VGA or higher-resolution monitor; Super VGA recommended
!       Microsoft Mouse or compatible pointing device
!       32 MB RAM (64 MB recommended)
!       Disk space required for installation: 50 MB.
USING C WITH UNIX
A little knowledge of UNIX operating system and commands is necessary before you can write and compile programs on the UNIX system. Every programmer goes through the same three-step cycle.

1.      Writing the program into a file
2.      Compiling the program
3.      Running the program.

During program development, the programmer may repeat this cycle many times, refining, testing and debugging a program until a satisfactory result is achieved. 

The UNIX commands for each step are discussed below.

Writing the Program

UNIX expects you to store your program in a file whose name ends in .c. This identifies it as a C program. The easiest way to enter your text is using a text editor like vi, emacs or xedit. To edit a file called testprog.c using vi type

vi testprog.c

The editor is also used to make subsequent changes to the program.

Compiling the Program

There are a number of ways to achieve this, though all of them eventually rely on the compiler (called cc on our system).

The C Compiler (cc)

The simplest method is to type

cc testprog.c

This will try to compile testprog.c, and, if successful, will produce a runnable file called a.out. If you want to give the runnable file a better name you can type
cc testprog.c -o testprog
This will compile testprog.c, creating runnable file testprog.

Running the Program

To run a program under UNIX you simply type in the filename. So to run program testprog, you would type
testprog
or if this fails to work, you could type
./testprog
You will see your prompt again after the program is done.


WHAT IS RUNNING C PROGRAM USING MS-VISUAL C++ 

Visual C++ is one of the most powerful and popular general-purpose programming languages. It is an extension of C / C++ programming language. Microsoft's Visual C++ is an Integrated Development Environment, or IDE. Microsoft Visual C++ has always been one of the most comprehensive and sophisticated software development environments available.

It has consistently provided a high level of programming power and convenience, while offering a diverse set of tools designed to suit almost every programming style.

Starting Microsoft Visual C++ 6.0

1.      On desktop, click on the Start button.

2.      Select Microsoft Visual Studio 6.0 option.
3.      Select Microsoft Visual C++6.0 option. You will see the main screen (figure).

4.      Click Close.

5.   After that you can see the blank interface like figure
6.  In the main screen select File menu, then click New. The New dialog box appears.

    You can see the screen like figure 


7.      Select File at the new dialog box. Then, select C++ Source File and click OK. The screen in figure 1.4 will appear.

      A blank text editor window (code window will appears).

Creating a program

1. Type your C source code in the text window as follows.


Save a program

1.      From the menu bar, select File and then select Save As.

2.      Select the appropriate directory .In lab session, we will save all our exercise in Directory desktop. So select save in Desktop.

3.  Type the name of the program file
C program
Example: program1.c

You must save all source code in C extension (means that, all in .c). Click Save button.

Compiling a program

1. From the menu bar select Built and then select Compile program1.c or just click icon compile. See below figure


You will get message that request you to need a workspace, so just answer Yes to the question. Visual C++ will create default workspace and then build your code. This will produce a .obj program file. It does not have proper link with the library (built-in library) yet.

If there are any program errors or warning messages, visual C++ will display them in the message window (shown in figure below). If there are no errors or warnings, you can execute your program.


Executing (build) a program

1. From the menu bar, select Build and then select Build program1.exe.     Or you can
Click build icon. See below figure.


2.   Now, the program code changes to .exe files extension. This extension you can see at         message window as shown in the figure 
Running a program

1. From the menu bar, select Build and then select Execute program.exe. or you can click execute program icon .See below figure 

 2.   Now, output will appear as shown in the figure. The output screen contains the printed results. Press any key to return to the program.

No comments:

Post a Comment