Skip to content
This repository was archived by the owner on May 15, 2021. It is now read-only.

Commit

Permalink
Modification when shift from windows to linux
Browse files Browse the repository at this point in the history
  • Loading branch information
avinashbest committed Dec 14, 2020
1 parent 5f98cfe commit 9c6212b
Show file tree
Hide file tree
Showing 89 changed files with 2,960 additions and 2,960 deletions.
26 changes: 13 additions & 13 deletions 1. CppBasics/Addition.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <iostream>
using namespace std;

int main(void)
{
int a, b, c;
cout << "Enter 2 Numbers: ";
cin >> a >> b; //Input from Console

c = a + b;

cout << "Addition = " << c << endl;
return 0;
#include <iostream>
using namespace std;

int main(void)
{
int a, b, c;
cout << "Enter 2 Numbers: ";
cin >> a >> b; //Input from Console

c = a + b;

cout << "Addition = " << c << endl;
return 0;
}
28 changes: 14 additions & 14 deletions 1. CppBasics/AreaofCircle.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include <iostream>
using namespace std;

int main(void)
{
float radius, area;

cout << "Enter Radius: ";
cin >> radius;
area = 3.1425f * radius * radius;

cout << "Area is " << area;

return 0;
#include <iostream>
using namespace std;

int main(void)
{
float radius, area;

cout << "Enter Radius: ";
cin >> radius;
area = 3.1425f * radius * radius;

cout << "Area is " << area;

return 0;
}
32 changes: 16 additions & 16 deletions 1. CppBasics/AreaofTriangle.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#include <iostream>
using namespace std;

int main(void)
{
//Variables
float area, height, base;
//Taking User Input
cout << "Enter Base & Height Respectively: ";
cin >> base >> height;
//Calculating Area of Triangle
area = (base * height) / 2;
//Printing Area to the console
cout << area << endl;

return 0;
#include <iostream>
using namespace std;

int main(void)
{
//Variables
float area, height, base;
//Taking User Input
cout << "Enter Base & Height Respectively: ";
cin >> base >> height;
//Calculating Area of Triangle
area = (base * height) / 2;
//Printing Area to the console
cout << area << endl;

return 0;
}
28 changes: 14 additions & 14 deletions 1. CppBasics/CompoundAssignment.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#include <iostream>
using namespace std;

int main()
{
int sum = 10, x = 5;
sum += x;
cout << sum << endl;

int fact = 10, y = 5;
fact *= y;
cout << fact << endl;

return 0;
#include <iostream>
using namespace std;

int main()
{
int sum = 10, x = 5;
sum += x;
cout << sum << endl;

int fact = 10, y = 5;
fact *= y;
cout << fact << endl;

return 0;
}
18 changes: 9 additions & 9 deletions 1. CppBasics/HelloWorld.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include <iostream> //Preprocessor Directive
using namespace std; //Global Namespace

int main(void)
{
cout << "Hello World" << endl; //Output to Console
// cin << Insertion Operator
// cout >> Extraction Operator
return 0;
#include <iostream> //Preprocessor Directive
using namespace std; //Global Namespace

int main(void)
{
cout << "Hello World" << endl; //Output to Console
// cin << Insertion Operator
// cout >> Extraction Operator
return 0;
}
44 changes: 22 additions & 22 deletions 1. CppBasics/IncDecOperator.cpp
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#include <iostream>
using namespace std;

int main()
{
int i = 5, j;
j = i++;
cout << j << " " << i << endl;

int k = 5, l;
l = ++k;
cout << l << " " << k << endl;

int a = 5, b;
b = 2 * ++a + 2 * a++;
cout << b << " " << a << endl;

int c = 5, d;
d = 2 * c++ + 2 * c++;
cout << d << " " << c << endl;

return 0;
#include <iostream>
using namespace std;

int main()
{
int i = 5, j;
j = i++;
cout << j << " " << i << endl;

int k = 5, l;
l = ++k;
cout << l << " " << k << endl;

int a = 5, b;
b = 2 * ++a + 2 * a++;
cout << b << " " << a << endl;

int c = 5, d;
d = 2 * c++ + 2 * c++;
cout << d << " " << c << endl;

return 0;
}
26 changes: 13 additions & 13 deletions 1. CppBasics/InputName.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
string name;
cout << "May I know Your Name ?" << endl;
getline(cin, name); //cin>>name;

cout << "Welcome! " << name << endl;

return 0;
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
string name;
cout << "May I know Your Name ?" << endl;
getline(cin, name); //cin>>name;

cout << "Welcome! " << name << endl;

return 0;
}
48 changes: 24 additions & 24 deletions 1. CppBasics/Overflow.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
#include <iostream>
using namespace std;

int main()
{
char a = 128;
cout << (int)a << endl;

char b = 127;
b++;
cout << (int)b << endl;

char c = -129;
cout << (int)c << endl;

char d = -128;
d--;
cout << (int)d << endl;

int e = INT_MAX;
e++;
cout << (int)e << endl;

return 0;
#include <iostream>
using namespace std;

int main()
{
char a = 128;
cout << (int)a << endl;

char b = 127;
b++;
cout << (int)b << endl;

char c = -129;
cout << (int)c << endl;

char d = -128;
d--;
cout << (int)d << endl;

int e = INT_MAX;
e++;
cout << (int)e << endl;

return 0;
}
36 changes: 18 additions & 18 deletions 1. CppBasics/RootsQuadraticEq.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include <iostream>
#include <cmath>
using namespace std;
//Finding the root of a Quadratic Equation
int main(void)
{
float a, b, c, x1, x2;

cout << "Enter the coefficients of x^2, x and constant terms respectively: ";
cin >> a >> b >> c;

x1 = (-b + sqrt((b * b) - (4 * a * c))) / (2 * a);
x1 = (-b - sqrt((b * b) - (4 * a * c))) / (2 * a);

cout << "\nRoots are:\n"
<< "x1 = " << x1 << " x2 = " << x2 << endl;

return 0;
#include <iostream>
#include <cmath>
using namespace std;
//Finding the root of a Quadratic Equation
int main(void)
{
float a, b, c, x1, x2;

cout << "Enter the coefficients of x^2, x and constant terms respectively: ";
cin >> a >> b >> c;

x1 = (-b + sqrt((b * b) - (4 * a * c))) / (2 * a);
x1 = (-b - sqrt((b * b) - (4 * a * c))) / (2 * a);

cout << "\nRoots are:\n"
<< "x1 = " << x1 << " x2 = " << x2 << endl;

return 0;
}
30 changes: 15 additions & 15 deletions 1. CppBasics/Speed.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#include <iostream>
using namespace std;

int main(void)
{
float u, v, a; //initial_velocity, final_velocity, acceleration
cout << "Enter Values: ";
cin >> u >> v >> a;

//Calculating speed using formula
int speed = ((v * v) - (u * u)) / (2 * a);

cout << "Speed = " << speed << endl;

return 0;
#include <iostream>
using namespace std;

int main(void)
{
float u, v, a; //initial_velocity, final_velocity, acceleration
cout << "Enter Values: ";
cin >> u >> v >> a;

//Calculating speed using formula
int speed = ((v * v) - (u * u)) / (2 * a);

cout << "Speed = " << speed << endl;

return 0;
}
Loading

0 comments on commit 9c6212b

Please sign in to comment.