Skip to content

Commit 5fff1be

Browse files
added tutorial 1 cpp file from local machine
1 parent 074a50f commit 5fff1be

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

tut1.cpp

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
// int c = 58;
5+
6+
int main()
7+
{
8+
//******** Build in data types********
9+
// int a, b, c;
10+
// cout<<"Enter the value of a: "<<endl;
11+
// cin>>a;
12+
// cout<<"Enter the value of b: "<<endl;
13+
// cin>>b;
14+
// c = a+b;
15+
// cout<<"The sum of a and b is: "<<c<<endl;
16+
// cout<<"The global c is: "<<::c<<endl;
17+
18+
//********Float, Double and Long Double Literals********
19+
// float d = 3.14f;
20+
// long double e = 3.14l;
21+
22+
// cout<<"The size of 3.14 is: "<<sizeof(3.14)<<endl;
23+
// cout<<"The size of 3.14f is: "<<sizeof(3.14f)<<endl;
24+
// cout<<"The size of 3.14F is: "<<sizeof(3.14F)<<endl;
25+
// cout<<"The size of 3.14l is: "<<sizeof(3.14l)<<endl;
26+
// cout<<"The size of 3.14L is: "<<sizeof(3.14L)<<endl;
27+
// cout<<"The size of d is: "<<d<<endl<<"The size of e is: "<<e<<endl;
28+
29+
//********Reference Variables********
30+
// here y is a refernce variable Pointing towards x
31+
32+
// float x = 455;
33+
// float & y = x;
34+
// cout<<x<<endl;
35+
// cout<<y<<endl;
36+
37+
//********Typecasting********
38+
//changing one variable type to another
39+
40+
// int a = 45;
41+
// float b = 45.45;
42+
43+
// cout<<"The value of a is: "<<(float)a<<endl;
44+
// cout<<"The value of a is: "<<float(a)<<endl;
45+
46+
// cout<<"The value of b is: "<<(int)b<<endl;
47+
// cout<<"The value of b is: "<<int(b)<<endl;
48+
49+
// int c = int(b);
50+
51+
// cout<<"The expression is: "<< a + b <<endl;
52+
// cout<<"The expression is: "<< a + int(b) <<endl;
53+
// cout<<"The expression is: "<< a + (int)b <<endl;
54+
55+
return 0;
56+
}

0 commit comments

Comments
 (0)