-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallCPP_basic.cpp
More file actions
200 lines (160 loc) · 4.24 KB
/
allCPP_basic.cpp
File metadata and controls
200 lines (160 loc) · 4.24 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#include <iostream>
#include <string>
using namespace std;
// f(x) = x^2 + 2
int add(int a, int b)
{
int c;
c = a + b;
return c;
}
class Employee
{
public:
string name;
int salary;
Employee(string n, int s, int sp)
{
this->name = n;
this->salary = s;
this->secretPassword = sp;
}
void printDetails()
{
cout << "The name of our first employee is " << this->name << " and his salary is " << this->salary << " Dollars" << endl;
}
void getSecretPassword()
{
cout<<"The secret password of employee is "<<this->secretPassword;
}
private:
int secretPassword;
};
class Programmer : public Employee
{
public:
int errors;
};
int main()
{
// cout<<"Hello World Aniket"<<endl;
// cout<<"Next line";
// int a, b, c;
// short s23423a=9;
// cout<<s23423a;
// camelCase Notation
// int marksInMaths=83;
// cout<<"The marks of the student in maths is "<<marksInMaths;
// string Aniket = "Aniket"
// short a;
// int b= 89;
// long c;
// long long d;
// float const score = 45.32;
// double score2 = 45.322;
// long double score3 = 45.332;
// score = 34.2;
// b = 34;
// cout<<"The score is "<<score;]
// int a, b;
// cout<<"Enter first number"<<endl;
// cin>>a;
// cout<<"Enter second number"<<endl;
// cin>>b;
// cout<<"a + b is "<<a + b<<endl;
// cout<<"a - b is "<<a - b<<endl;
// cout<<"a * b is "<<a * b<<endl;
// cout<<"a / b is "<<(float) a / b<<endl;
// int age;
// cout << "Enter your age" << endl;
// cin >> age;
// switch (age)
// {
// case 12:
// cout << "You are 12 years old"<<endl;
// break;
// case 18:
// cout << "You are 18 years old"<<endl;
// break;
// default:
// cout << "You are neither 12 nor 18 years old";
// }
// if(age>150 || age<1)
// {
// cout<<"Invalid age";
// }
// else if (age>=18){
// cout<<"You can vote";
// }
// else
// {
// cout<<"You cannot vote";
// }
// int index = 0;
// while(index<34)
// {
// cout<<"We are at index number "<<index<<endl;
// index = index + 1;
// }
// do
// {
// cout << "We are at index number " << index << endl;
// index = index + 1;
// } while (index < 33);
// for (int i = 1; i <= 34; i++)
// {
// cout<<"The value of i is "<<i<<endl;
// }
// int a, b;
// cout<<"Enter first number"<<endl;
// cin>>a;
// cout<<"Enter second number"<<endl;
// cin>>b;
// cout<<"The function returned "<<add(a,b);
// int arr[] = {1, 3, 6};
// // Array Index 0 1 2
// // cout<<arr[1];
// int marks[6];
// for (int i = 0; i < 6; i++)
// {
// cout<<"Enter the marks of "<<i<<"th student"<<endl;
// cin>>marks[i];
// }
// for (int i = 0; i < 6; i++)
// {
// cout<<"Marks of "<<i<<"th student is "<<marks[i]<<endl;
// }
// int arr2d[2][3] = { {1,2,3},
// {4,5,6}};
// for (int i = 0; i < 2; i++)
// {
// for (int j = 0; j < 3; j++)
// {
// cout<<"The value at "<<i<<","<<j<<" is "<<arr2d[i][j]<<endl;
// }
// }
// int a =343;
// float b = 87.94;
// cout<<(float) a/34<<endl;
// cout<<(int) b;
// string name = "Aniket";
// cout<<"The name is "<<name<<endl;
// cout<<"The length of name is "<<name.length()<<endl;
// cout<<"The name is "<<name.substr(1,155)<<endl;
// cout<<"The name is "<<name.substr(2,3);
// float a = 34.34;
// float* ptra;
// ptra = &a;
// cout<<"The value of a is "<<a<<endl;
// cout<<"The value of a is "<<*ptra<<endl;
// cout<<"The address of a is "<<&a<<endl;
// cout<<"The address of a is "<<ptra<<endl;
Employee ani("Aniket constructor", 344, 324432);
// ani.name = "Aniket";
// ani.salary = 100;
ani.printDetails();
ani.getSecretPassword();
// cout<<ani.secretPassword;
// cout<<"The name of our first employee is "<< ani.name << " and his salary is "<<ani.salary<<" Dollars"<<endl;
return 0;
}