-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.cpp
61 lines (42 loc) · 1015 Bytes
/
variables.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include<string>
using namespace std;
#define NewL '\n'
int main() {
/* Adtran interview question with Gary Culp Group:
The main mistake was the big or little Endian questions.
And hence typecasting mistake.*/
int a=0x123456;
char *ptr=(char*)&a;
cout<<"The contenst of A: \n"<<a<<endl;
cout<<"the contents are : \n"<<*ptr<<endl;
/*-------------------------------------------------------*/
/*
The Next bunch of code is the basics of variables.
*/
//Integer addition..
int b=4;
int c{6};
int result(0);
result = b-c;
cout<<"The result of B-C is "<<result<<endl;
//String Basics
string myString;
myString = "This is string One. \n";
cout<<myString;
//Conditional ternary operators
result = c>b ? c : b;
cout <<"The greater of C and B is :"<<result<<endl;
/*
Basic input out to receive and send out data.
*/
int age(0);
cout<<"Enter Your Age: \n";
cin>>age;
age+=10;
cout<<"You will be "<<age<<" years old in 10 years. \n";
/*
Price , Quantity and total cost.
*/
return 0;
}