NIIT Vile Parle
NIIT Vile Parle
Class car
{
Float Example
price;
};
In the above example, the variable price of type float is
declared inside the class car.
Accepting and storing values in member variables
Example
Class car
{
float price;
public:
void acceptprice()
{
cout << “enter price :”;
cin >> price;
}
};
In case of the above code, the message “enter price” is displayed. The
cursor blinks on the screen and waits for the user to enter data in the
variable
Components of c++ program
#include<iostream.h>
int main()
{
return 0;
}
Before any array variable can be initialized, its data type and
size must be defined.
#include <iostream>
Class loops Output
{
int num1;
int num2; 1
public; 1
void fibonacci() 2
{
num1=num2=1; 3
cout <<num1 << endl; 5
while (num2 < 200) 8
{
13
cout <<num2 << endl;
num2+= num1; 21
num1 = num2 – num1; 34
} 55
}
};
89
int main() 144
{
Loop l1;
L1.fibonacci ();
Return 0;
}
Criticism
First, since C++ includes most of C as a subset, it
inherits many of the criticisms leveled at C. For its
large feature set, it is criticized as being over-
complicated, and difficult to fully master.
Other criticism stems from what is missing from C++.
For example, the current version of Standard C++
provides no language features to create multi-
threaded software. These facilities are present in some
other languages including Java and C#.
THANK YOU