Skip to content

Commit a3b9b7d

Browse files
committed
add: refactor
1 parent 6bef0e1 commit a3b9b7d

File tree

139 files changed

+170
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+170
-145
lines changed

01_basics_of_c++/01_print.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main()
1313

1414
cout << "cpp-programming"; // cout is a predefined object used to print output on screen
1515

16-
getch();
16+
cin.ignore();
1717
return 0;
1818
}
1919
// // Main Function End

01_basics_of_c++/02_endl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int main()
1515
<< "programming"; // endl is used to add new line '\n' char
1616

1717
cout << endl; // Add new line
18-
getch();
18+
cin.ignore();
1919
return 0;
2020
}
2121
// // Main Function End

01_basics_of_c++/03_sum.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int main()
2020
cout << "\nSum of " << num1 << " and " << num2 << " => " << sum;
2121

2222
cout << endl; // Add new line
23-
getch();
23+
cin.ignore();
2424
return 0;
2525
}
2626
// // Main Function End

01_basics_of_c++/04_area_of_circle.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main()
2121
cout << "\nArea of Circle Having Radius " << radius << " is " << area;
2222

2323
cout << endl; // Add new line
24-
getch();
24+
cin.ignore();
2525
return 0;
2626
}
2727
// // Main Function End

01_basics_of_c++/05_volume_of_cuboid.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main()
2121
cout << "\nVolume of Cuboid => " << vol;
2222

2323
cout << endl; // Add new line
24-
getch();
24+
cin.ignore();
2525
return 0;
2626
}
2727
// // Main Function End

01_basics_of_c++/06_average.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main()
2121
cout << "\nAverage => " << avg;
2222

2323
cout << endl; // Add new line
24-
getch();
24+
cin.ignore();
2525
return 0;
2626
}
2727
// // Main Function End

01_basics_of_c++/07_square.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int main()
2020
cout << "\nSquare of " << num << " => " << square;
2121

2222
cout << endl; // Add new line
23-
getch();
23+
cin.ignore();
2424
return 0;
2525
}
2626
// // Main Function End

01_basics_of_c++/08_swap_without_third_var.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main()
4141
cout << "a => " << a << ", b => " << b;
4242

4343
cout << endl; // Add new line
44-
getch();
44+
cin.ignore();
4545
return 0;
4646
}
4747
// // Main Function End

01_basics_of_c++/09_largest_of_two.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ int main()
2727
cout << "\nLargest of " << num1 << " and " << num2 << " => " << largest;
2828

2929
cout << endl; // Add new line
30-
getch();
30+
cin.ignore();
3131
return 0;
3232
}
3333
// // Main Function End

01_basics_of_c++/10_sum_of_array.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main()
3030
cout << "\n\nSum of Numbers => " << sum;
3131

3232
cout << endl; // Add new line
33-
getch();
33+
cin.ignore();
3434
return 0;
3535
}
3636
// // Main Function End

02_functions/01_is_prime.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int main()
3131
}
3232

3333
cout << endl; // Add new line
34-
getch();
34+
cin.ignore();
3535
return 0;
3636
}
3737
// // Main Function End

02_functions/02_highest_value_digit.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int main()
2323
cout << "\nHighest value Digit of " << num << " => " << highDigit;
2424

2525
cout << endl; // Add new line
26-
getch();
26+
cin.ignore();
2727
return 0;
2828
}
2929
// // Main Function End

02_functions/03_power.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main()
2929
<< base << " Raised to the Power of " << exp << " => " << res;
3030

3131
cout << endl; // Add new line
32-
getch();
32+
cin.ignore();
3333
return 0;
3434
}
3535
// // Main Function End

02_functions/04_is_term_in_fibonacci.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main()
3030
}
3131

3232
cout << endl; // Add new line
33-
getch();
33+
cin.ignore();
3434
return 0;
3535
}
3636
// // Main Function End

02_functions/05_pascal_triangle.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ int main()
4343
pascalTriangle(lines);
4444

4545
cout << endl; // Add new line
46-
getch();
46+
cin.ignore();
4747
return 0;
4848
}
4949
// // Main Function End

02_functions/06_swap_using_reference.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main()
2929
cout << "a => " << a << ", b => " << b;
3030

3131
cout << endl; // Add new line
32-
getch();
32+
cin.ignore();
3333
return 0;
3434
}
3535
// // Main Function End

02_functions/07_default_argument.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main()
2929
cout << "\nSum of " << num1 << ", " << num2 << " and " << num3 << " => " << add(num1, num2, num3);
3030

3131
cout << endl; // Add new line
32-
getch();
32+
cin.ignore();
3333
return 0;
3434
}
3535
// // Main Function End

02_functions/08_overloaded_area_fun.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main()
3030
cout << "\nArea of Circle => " << area(radius);
3131

3232
cout << endl; // Add new line
33-
getch();
33+
cin.ignore();
3434
return 0;
3535
}
3636
// // Main Function End

02_functions/09_overloaded_largest_of_two.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main()
3030
cout << "\nLargest of " << num3 << " and " << num4 << " => " << largestOfTwo(num3, num4);
3131

3232
cout << endl; // Add new line
33-
getch();
33+
cin.ignore();
3434
return 0;
3535
}
3636
// // Main Function End

02_functions/10_overloaded_add.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main()
3030
cout << "\nSum of " << num3 << " and " << num4 << " => " << addTwoNums(num3, num4);
3131

3232
cout << endl; // Add new line
33-
getch();
33+
cin.ignore();
3434
return 0;
3535
}
3636
// // Main Function End

03_classes_and_objects/01_complex.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int main()
5151
c1.displayComplex(); // display complex number
5252

5353
cout << endl; // Add new line
54-
getch();
54+
cin.ignore();
5555
return 0;
5656
}
5757
// // Main Function End

03_classes_and_objects/02_time.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int main()
5353
t1.displayTime(); // display time
5454

5555
cout << endl; // Add new line
56-
getch();
56+
cin.ignore();
5757
return 0;
5858
}
5959
// // Main Function End

03_classes_and_objects/03_factorial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main()
5858
cout << "\nFactorial of " << num << " => " << fact;
5959

6060
cout << endl; // Add new line
61-
getch();
61+
cin.ignore();
6262
return 0;
6363
}
6464
// // Main Function End

03_classes_and_objects/04_largest_of_two.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int main()
8585
cout << "\nLargest Number => " << largest;
8686

8787
cout << endl; // Add new line
88-
getch();
88+
cin.ignore();
8989
return 0;
9090
}
9191
// // Main Function End

03_classes_and_objects/05_student.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int main()
7171
cout << "\nStudent's Name => " << s1.getName(name);
7272

7373
cout << endl; // Add new line
74-
getch();
74+
cin.ignore();
7575
return 0;
7676
}
7777
// // Main Function End

03_classes_and_objects/06_square.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int main()
7676
cout << "\nYou Have Calculated Square of " << Square::countFunctionCalls << " Numbers";
7777

7878
cout << endl; // Add new line
79-
getch();
79+
cin.ignore();
8080
return 0;
8181
}
8282
// // Main Function End

03_classes_and_objects/07_reverse_number.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main()
6161
cout << "\nReverse of " << num << " => " << rev;
6262

6363
cout << endl; // Add new line
64-
getch();
64+
cin.ignore();
6565
return 0;
6666
}
6767
// // Main Function End

03_classes_and_objects/08_rectangle.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int main()
7979
cout << "\nArea of Rectangle => " << area;
8080

8181
cout << endl; // Add new line
82-
getch();
82+
cin.ignore();
8383
return 0;
8484
}
8585
// // Main Function End

03_classes_and_objects/09_circle.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int main()
6060
cout << "\nArea of Circle => " << area;
6161

6262
cout << endl; // Add new line
63-
getch();
63+
cin.ignore();
6464
return 0;
6565
}
6666
// // Main Function End

03_classes_and_objects/10_area.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ int main()
112112
cout << "\nArea of Circle => " << area;
113113

114114
cout << endl; // Add new line
115-
getch();
115+
cin.ignore();
116116
return 0;
117117
}
118118
// // Main Function End

04_instance_and_static_members/01_complex.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ int main()
9292
c3.showData();
9393

9494
cout << endl; // Add new line
95-
getch();
95+
cin.ignore();
9696
return 0;
9797
}
9898
// // Main Function End

04_instance_and_static_members/02_time.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ int main()
136136
cout << "\nNormalization of Added Time Period => " << normalizedTime;
137137

138138
cout << endl; // Add new line
139-
getch();
139+
cin.ignore();
140140
return 0;
141141
}
142142
// // Main Function End

04_instance_and_static_members/03_person.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int main()
7272
cout << "\nPerson's Name => " << p1.getName(name);
7373

7474
cout << endl; // Add new line
75-
getch();
75+
cin.ignore();
7676
return 0;
7777
}
7878
// // Main Function End

04_instance_and_static_members/04_rectangle.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int main()
7878
cout << "\nArea of Rectangle => " << area;
7979

8080
cout << endl; // Add new line
81-
getch();
81+
cin.ignore();
8282
return 0;
8383
}
8484
// // Main Function End

04_instance_and_static_members/05_circle.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int main()
5959
cout << "\nCircumference of Circle => " << circumference;
6060

6161
cout << endl; // Add new line
62-
getch();
62+
cin.ignore();
6363
return 0;
6464
}
6565
// // Main Function End

04_instance_and_static_members/06_bank_account.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int main()
7474
cout << "\nEnter BankAccount's Name (MAX_CHARACTERS " << MAX_CHARS_NAME - 1 << ") => ";
7575
cin.getline(name, MAX_CHARS_NAME);
7676

77-
cout<<name<<endl;
77+
cout << name << endl;
7878

7979
// // set persons's name
8080
b1.setName(name);
@@ -131,7 +131,7 @@ int main()
131131
}
132132

133133
cout << endl; // Add new line
134-
getch();
134+
cin.ignore();
135135
return 0;
136136
}
137137
// // Main Function End

04_instance_and_static_members/07_student.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ int main()
105105
cout << "\nAverage Marks => " << s1.calculateAvgofMarks();
106106

107107
cout << endl; // Add new line
108-
getch();
108+
cin.ignore();
109109
return 0;
110110
}
111111
// // Main Function End

04_instance_and_static_members/08_math_operations.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int main()
4444
cout << "\nSquare of " << num << " => " << sq;
4545

4646
cout << endl; // Add new line
47-
getch();
47+
cin.ignore();
4848
return 0;
4949
}
5050
// // Main Function End

04_instance_and_static_members/09_library.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int main()
9090
cout << "\nTotal Books In Library => " << Library::getTotalBooks() << endl;
9191

9292
cout << endl; // Add new line
93-
getch();
93+
cin.ignore();
9494
return 0;
9595
}
9696
// // Main Function End

04_instance_and_static_members/10_static_count.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int main()
4848
cout << "\n\nValue of Count After Calling Function 3 Times => " << StaticCount::getCount();
4949

5050
cout << endl; // Add new line
51-
getch();
51+
cin.ignore();
5252
return 0;
5353
}
5454
// // Main Function End

04_instance_and_static_members/11_counter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int main()
3232
cout << "\nValue of Count => " << Counter::getCount() << endl;
3333

3434
cout << endl; // Add new line
35-
getch();
35+
cin.ignore();
3636
return 0;
3737
}
3838
// // Main Function End

04_instance_and_static_members/12_employee.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ int main()
9191
cout << "\n\nNumber of Employees => " << Employee::getTotalEmployees() << endl;
9292

9393
cout << endl; // Add new line
94-
getch();
94+
cin.ignore();
9595
return 0;
9696
}
9797
// // Main Function End

0 commit comments

Comments
 (0)