Bjarne StropStrup invented the C++ at bell telephone laboratories in the year 1980’s. C++ & VB is a high level language.
Data Types:
Integer - 2 Bytes
Float - 4 Bytes
Char - 1 Byte
Double - 8 Bytes
Long int - 4 Bytes
Int:
Eg:
78, 34, 678, 1000 -------------
Float:
Eg:
67.003, 23.468, 78.3876 -------------
Char:
Eg:
‘A’, ‘B’, ‘C’, -------------------
String:
‘Table’, ‘Chair’, ‘Pen’, ‘Pencil’ -----------
Double:
Eg:
45.000000000000, 12.0123456789000 ------------
cout - Output Process
cin - Input Process
cout - << left shift
cin - >> right shift
Header Files: (PreProcesor)
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
#include<malloc.h> etc…
Iostream.h = Input Output stream. HeaderFiles
Conio.h = Console Input Output . HeaderFiles
There are 32 Keywords
1. Auto
2. If -
3. Double -
4. Struct
5. Do -
6. Long -
7. Signed
8. Extern
9. Typedef
10. Return
11. Char -
12. Register
13. Short
14. Sizeof -
15. Break -
16. Continue
17. Volatile
18. Goto
19. Static
20. While -
21. Float -
22. Union
23. Else -
24. Switch -
25. Case -
26. Enum
27. Const
28. Void -
29. For -
30. Unsigned
31. Default -
32. Int -
Syntax:
Main()
{
Variable Declarations;
Program Statements;
}
Command Line:
// /* */
--------------------------
/*-------------------------
//--------------------------
//--------------------------
----------------------------*/
--------------------------
“\n” = New Line
“\t” = Horizontal Tab
endl = end line
ShortCut Keys:
F1 = Help
F2 = Save
F3 = Open
F5 = Zoom
F6 = To see the previous program
Alt F9 = To compile the program
Ctrl F9 = To run the program
Alt F5 (or) Getch() = To see the output answer
Alt X = Quit
Alt F = To open the File menu
Operators:
1. Arithmetic Operator
2. Relational and Logical Operator
3. Arithmetic Assignment Operator
4. Increment and Decrement Operator
5. Bitwise logical Operator
1.Arithmetic Operator:
+, -, *, /, %
2.Relational Operator:
>, <, >=, <=, = =, !=
3.Arithmetic assignment Operator:
+=, -=, *=, /=, %=
4. Increment and decrement Operator:
++, --, SizeOf
++ = Increment Operator
-- = Decrement Operator
Prefix increment = ++i
Postfix increment = i++
Prefix decrement = --i
Postfix decrement = i--
5. Bitwise Logical Operator:
& - Bitwise Logical AND
|| - Bitwise Logical OR
^ - Bitwise Exclusive OR
<< - Left Shift
>> - Right Shift
Prog:
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
cout<<“Enter a values:”;
cin>>a;
cout<<”Enter b values:”;
cin>>b;
c=a+b;
cout<<“Answer=” <<c;
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
int cm;
float mt;
clrscr();
cout<<”Enter the value in centimeters:”;
cin>>cm;
mt=cm/100.0;
cout<<”The equivalent meter values is:”<<mt;
getch();
}
No comments:
Post a Comment