Important: Use custom search function to get better results from our thousands of pages

Use " " for compulsory search eg:"electronics seminar" , use -" " for filter something eg: "electronics seminar" -"/tag/" (used for exclude results from tag pages)


 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Introduction to C++
Post: #1

Introduction to C++

.ppt  Introduction to C++.PPT (Size: 75.5 KB / Downloads: 176)
Introduction to C++
Noppadon Kamolvilassatian
Department of Computer Engineering
Prince of Songkla University
1. Introduction
C++ improves on many of C’s features.
C++ provides object-oriented programming (OOP).
C++ is a superset to C.
No ANSI standard exists yet (in 1994).
2. C++ Single-Line Comments
In C,
/* This is a single-line comment. */
In C++,
// This is a single-line comment.
3. C++ Stream Input/Output
In C,
printf(“Enter new tag: “); scanf(“%d”, &tag); printf(“The new tag is: %d\n”, tag);
In C++,
cout << “Enter new tag: “; cin >> tag; cout << “The new tag is : “ << tag << ‘\n’;
3.1 An Example
// Simple stream input/output
#include <iostream.h>

main()
{
cout << "Enter your age: ";
int myAge;
cin >> myAge;

cout << "Enter your friend's age: ";
int friendsAge;
cin >> friendsAge;

if (myAge > friendsAge)
cout << "You are older.\n";
else
if (myAge < friendsAge)
cout << "You are younger.\n";
else
cout << "You and your friend are the same age.\n";

return 0;
}
4. Declarations in C++
In C++, declarations can be placed anywhere (except in the condition of a while, do/while, for or if structure.)
An example
cout << “Enter two integers: “;
int x, y;
cin >> x >> y;
cout << “The sum of “ << x << “ and “ << y
<< “ is “ << x + y << ‘\n’;

Another example

for (int i = 0; i <= 5; i++)
cout << i << ‘\n’;
5. Creating New Data Types in C++
struct Name {
char first[10];
char last[10];
};
In C,
struct Name stdname;
In C++,
Name stdname;
The same is true for enums and unions
6. Reference Parameters
In C, all function calls are call by value.
Call be reference is simulated using pointers
Reference parameters allows function arguments to be changed without using return or pointers.
6.1 Comparing Call by Value, Call by Reference with Pointers and Call by Reference with References
#include <iostream.h> int sqrByValue(int); void sqrByPointer(int *); void sqrByRef(int &); main() { int x = 2, y = 3, z = 4; cout << "x = " << x << " before sqrByVal\n" << "Value returned by sqrByVal: " << sqrByVal(x) << "\nx = " << x << " after sqrByVal\n\n";


cout << "y = " << y << " before sqrByPointer\n"; sqrByPointer(&y); cout << "y = " << y << " after sqrByPointer\n\n";
cout << "z = " << z << " before sqrByRef\n"; sqrByRef(z); cout << "z = " << z << " after sqrByRef\n"; return 0; }

int sqrByValue(int a) { return a *= a;
// caller's argument not modified } void sqrByPointer(int *bPtr) { *bPtr *= *bPtr;
// caller's argument modified } void sqrByRef(int &cRef) { cRef *= cRef;
// caller's argument modified }
Output
$ g++ -Wall -o square square.cc
$ square
x = 2 before sqrByValue
Value returned by sqrByValue: 4
x = 2 after sqrByValue

y = 3 before sqrByPointer
y = 9 after sqrByPointer

z = 4 before sqrByRef
z = 16 after sqrByRef
7. The Const Qualifier
Used to declare “constant variables” (instead of #define)
const float PI = 3.14156;

The const variables must be initialized when declared.
Post: #2
Introduction to C++


.ppt  Introduction to C++.ppt (Size: 339.5 KB / Downloads: 25)

C++

C++ is an object-oriented programming language.
Developed by Bjarne Stroustrup at AT&T Bell opeLaboratories, USA in the early 1980’s.
Idea of c++ comes from increment operator ‘++’
C++ is n incremented version of C

Versions of C++

Traditional version
Based upon Bjarne Stroustrup’s original designs
Standard C++
Created by Stroustrup and the ANSI/ISO standardization committee
Standard C++ is a superset of traditional C++

A Simple Program

C++ works by giving (separate) instructions to the computer.
These instructions can be written as functions.
The primary function used in C++ is called main. This means that every C++ program should have the main() function. Because a function is an assignment, in order to perform its job, a function has a body. The body of a function starts with an opening curly bracket "{" and closes with a closing curly bracket "}".

using namespace std;

Namespace is a new concept introduced by the ANSI C++ standards committee.
provide a means of grouping logically related identifiers into corresponding namespaces
std is the namespace where ANSI C++ standard class libraries are defined.
allows you to use cout and endl without the prefix std::. It means that if you do not
include this statement, then cout should be used as std::cout and endl should be used as std::endl.

Int main()

A C++ program is a collection of functions, one of which is the function main.
The main function is the point by where all C++ programs start their execution, independently of its location within the source code.
In C++, main () returns an integer value to the operating system.
the default return type for all function in C++ is int.
 

Marked Categories : c features, seminar topics for computer science cpp, introduction to c, ppt topics computer science c best seminar, seminar topic introduction to c, ppt of introduction to c, computer sciences seminar topics c, seminar topics on computer science c language, c ppt, latest topics for computer science seminar on c and c programming, seminar topics in new technology of c, c main topicks ppt, ppt on c introduction, seminar topic for c, computer science seminar topics with c progrm pdf, introduction to c ppt, tiopics for seminar in c, c topics for seminar, seminar topics of c ppt, seminar topics for c, c ppt topics, c topics for seminars, c seminar topics,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Image Verification
(case insensitive)
Please enter the text within the image on the left in to the text box below. This process is used to prevent automated posts.

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  box shifting mechanism introduction basics Guest 1 330 11-10-2017 09:28 AM
Last Post: jaseela123
Photo introduction of micro air vehicle seminar report Guest 1 220 04-10-2017 03:00 PM
Last Post: jaseela123
  download ppt of maths on topic introduction to graph class 8 Guest 0 225 30-09-2017 10:18 AM
Last Post: Guest
  introduction to safe construction practices wikipedia Guest 1 0 20-09-2017 03:09 PM
Last Post: jaseela123
  Wireless LAN Security Introduction study tips 1 400 20-09-2017 12:40 PM
Last Post: jaseela123
  A Technical Introduction to USB 2.0 seminar flower 1 891 19-09-2017 10:42 AM
Last Post: jaseela123
  INTRODUCTION TO COMPUTER NETWORKS PPT project girl 1 893 19-09-2017 09:48 AM
Last Post: jaseela123
  12 std commerce project partnership firm process and procedure introduction Guest 1 0 15-09-2017 12:44 PM
Last Post: jaseela123
  OPERATING SYSTEM INTRODUCTION PPT project girl 1 383 13-09-2017 03:22 PM
Last Post: jaseela123
  INTRODUCTION OF TECHNICAL ANALYSIS seminar flower 1 1,277 13-09-2017 03:18 PM
Last Post: jaseela123
This Page May Contain What is Introduction to C++ And Latest Information/News About Introduction to C++,If Not ...Use Search to get more info about Introduction to C++ Or Ask Here

Options: