Professional Documents
Culture Documents
Experiment No 18
Experiment No 18
Introduction
C-Free is an Integrated Development Environment (IDE) for C and C++ programming language. With
this environment you can edit, build, run, and debug your program freely, Dev-C++ is a free integrated
development environment (IDE) for programming in C/C++. Dev-C++ is developed by Bloodshed
software. Dev-C++ you can write Windows or console-based C/C++ programs easily, you can even
create installer for your application.
Objectives
In this lab software (DEV C++ and C Free) introduction has been discussed along with basic writing of
the program inside the compiler and its steps.
Outcomes
By the end of this experiment, student will have basic understanding of
How to open the C Free 5.0/Dev C++
Write and execute a simple program that print a simple statement.
Find and correct the errors.
Theory Overview
C++ is a statically-typed, free-form, (usually) compiled, multi-paradigm, intermediate-level general-
purpose middle-level programming language. Many of today’s operating systems, system drivers,
browsers and games use C++ as their core language. This makes C++ and its software like C Fee and
DEV C++ an excellent choice. Since it is an enhanced/extended version of C programming language,
C and C++ are often denoted together as C/C++.
Software / Hardware:
A PC system.
Visio 2013.
Procedure
Step 1
Open the working environment DEV C++ as shown in figure 29.1
Step 3
Name the project as shown in Figure 29.3
Step 4
Save the project as shown in Figure 29.4
2
Figure 29.4: Location of the saved C++ project
Step 5
Create new file as shown in Figure 29.5
Step 6
Write a C code to print” Hello world” on the output screen as shown in Figure 29.6
3
Figure 29.7: Location of the saved C++ source file
Step 8
Compile the program using key F9 and run the code using F10 as shown in figure 29.8
Step 9
Show the Output on screen as shown in Figure 1.9
4
Introduction to C Free software
Step1
Step 2
C Free Working Environment as shown in Figure 29.11
Step 3
Create the New Project as shown in Figure 29.12
5
Step 4
Step 5
Save the file test.cpp as shown in Figure 29.14
Figure 29.14: Naming and saving the C++ source file in C-Free
6
Step 6
Step 7
Run the program by click on run button or press F5 key as shown in Figure 2.6
Program 1
Write a program to print your name on the output screen
7
#include <iostream>
/* this program is print your name on the output
screen */ using namespace std;
int main( )
{
cout<<"Shahid
Ali"<<endl; return 0;
}
Program 2
Write a program to calculate the sum of any two numbers on the output screen
#include
<iostream> using
namespace std; int
main( ) {
int a,b,sum;
a=2;
b=3;
sum=a+b;
cout<<"Sum
="<<sum<<endl; return 0;
}
Program 3
Write a program to multiply any two numbers and print the result on the output screen
#include
<iostream> using
namespace std; int
main( ) {
int a,b,mul;
a=2;
b=3;
mul=a*b;
cout<<"Multiply
="<<mul<<endl; return 0;
}
Review Questions
Question 1
Write down the syntax for declaration of variable
Question 2
Write a C++ program to compute area of a rectangle.
8
Question 3
Write a C++ program to compute area of a circle.
Question 4
A student appears in an examination consisting of total 3 subjects with each subject
having maximum marks of 100. The student’s roll number and obtained marks in each
subject is given as an input. Write a C++ program to compute the percentage of the
student and print it with his/her roll number.
Question 5
Write a program to add and multiply any three variables a,b,c and print the
result on the output screen.
Rubrics
Lab Performance
Lab Report
9
2 Calculations All of the data Most of the data Some of data Most of the data All of the data
analyzed is very analyzed is analyzed is analyzed is analyzed is
accurate and accurate with many accurate having inaccurate based inaccurate
precise. logical and few logical and on illogical based on
Completely systematic systematic calculations illogical
logical and calculations calculations calculations.
systematic
calculations
Viva Voce
Sr. Performance Excellent Good Average Fair Poor
# Indicator 5 4 3 2 1
1 Responsivenes Responds well, Generally Generally Not much Non
s to quick and very Responsive and Responsive and Responsive and Responsive
Questions/ accurate all the accurate most of the accurate few times. accurate most of and inaccurate
Accuracy time. times. the times. all the times.
2 Level of Provide complete Provide complete Provide partially Provide very few Provide no
understanding and logical and logical answers correct and logical and illogical answer to the
of the learned answers based based upon accurate answers based upon answers to the questions
skill upon accurate technical content to minimum technical questions asked asked by
technical content the questions asked content to the by examiner. examiner.
to the questions by examiner with questions asked by
asked by few errors examiner
examiner
10