Uploaded by sawera.naseer171780276

Begin C++

advertisement
UNIVERSITY OF ENGINEERING AND TECHNOLOGY, LAHORE
(NAROWAL CAMPUS)
(UET)
BSc. BIOMEDICAL ENGINEERING
(BME-2021)
LAB REPORTS
Course Title: Computing Fundamental
Course Code: CS 101
Submitted By:
Muhammad Faisal Mehmood
2021-BME-102
Department of Biomedical Engineering
Submitted to:
Dr. Sameen Ahmad Malik
Associate Professor
Date of Submission: 25 Jan 2021
How to do programming by using C++
Objective
In this lab we use C++ and make a small program than compile and run the program
Introduction
C++ is an object oriented Language .C++ program are modeled around objects and
classes which you can control and manipulated by applying function.
Literature Review
C++ is one of the oldest programming languages, so there are many different versions.
The C++ programming language was invented in 1979 by Bjarne Stroustrup while working
on his PhD thesis at Bell Labs. The name was changed to C++ in 1983, which derives
from the ++ operator. C++ was released for commercial use in 1985, but it was not yet
standardized. In 1990, Borland’s Turbo C++ compiler was released, which added many
new features. The first international standard for C++ was published in 1998, known as
C++98.The language saw another revision in 2011 when C++11 was completed. This
version includes features such as Regex support, new libraries, new syntax for loops, the
auto keyword, and new container classes, amongst other things. Since that time, two
more revisions have been released, C++14 and C++17.
Method
In this assignment I use Dev software to make small program compile and run the
program. I use my laptop to run the software and ready my computer to start programing.
Result and Discussion
Syntax:
Syntax is the grammar like program .Without the syntax it is impossible to run the
program. For example #include<iostream> is the syntax before the programing syntax
must be used .We cannot write the syntax program cannot run. In syntax small mistake
give me a error program cannot run
Using name std
Using namespace std means that we are using object and variable names from the
standard library. When we write std::cout<<hello world and happy; and run the program
after run the program we print the happy word
Comment
Comments can be used to explain C++ code, and to make it more readable. It can also
be used to prevent execution when testing alternative code. /* is used at the start and end
of sentence.
Including two \n\n creates a blank space. By writing return 0, we are telling the program
that nothing will return. We are only outputting strings of text. Note that we use the <<
operator to name our objects. The semi colon (;) functions like a period.
Using name std at bottom
When we write the using name std at the bottom we cannot write the std::cout<< again
and print after run the program .Using namespace std help to make small program when
we write using namespace at the bottom we cannot write this syntax again and again.
Semicolon
If we cannot write the semicolon; at the last program cannot run and display the error.
Semicolon must be used at the last. When we cannot write the semicolon at the last it
display the error. Small semicolon give the error
cin and cout in C++
cin is an object of the input stream and is used to take input from input streams like files,
console, etc. cout is an object of the output stream that is used to show output. Basically,
cin is an input statement while cout is an output statement.
Return 0
The return statement returns the flow of the execution to the function from where it is
called. This statement does not mandatorily need any conditional statements. As soon as
the statement is executed, the flow of the program stops immediately and return the
control from where it was called.
Int main
'int main' means that our function needs to return some integer at the end of the execution
and we do so by returning 0 at the end of the program. 0 is the standard for the “successful
execution of the program”
Conclusion
C++ is a multi-purpose programming language used widely across the world. There is no
doubt that even after being a very old language, it is one of the most efficient programming
languages.
•
Portability. C++ provides this feature of portability allowing us to develop codes
without caring about the hardware.
•
Mid-level programming language.
•
Object-Oriented.
•
Multi-paradigm programming language.
•
Memory Management.
•
Fast and Powerful.
•
Similar to other languages.
•
Standard Library.
Related documents
Download