Skip to content

Commit 832197c

Browse files
committed
Created new tasks
1 parent 6a5d5ad commit 832197c

Some content is hidden

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

59 files changed

+1325
-882
lines changed
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
//U1910049 Rustam Zokirov
2-
//Section 004
3-
//Assignment-2(Operators)
4-
//C++ program to Calculate Area and Circumference of Circle
1+
// Rustam Zokirov
2+
// C++ program to Calculate Area and Circumference of Circle
53

64
#include <iostream>
5+
76
using namespace std;
8-
int main(){
7+
8+
int main()
9+
{
910
cout << "\t\tC++ program to Calculate Area and Circumference of Circle.\n";
1011
float R, Area, Circumference;
11-
cout << "Please enter the Radius of Circle: " ;
12+
cout << "Please enter the Radius of Circle: ";
1213
cin >> R;
13-
if (R > 0) {
14+
if (R > 0)
15+
{
1416
Area = 3.14 * R * R;
1517
Circumference = 2 * 3.14 * R;
1618
cout << "Area of Circle is " << Area << ";" << endl;
1719
cout << "Circumference of Circle is " << Circumference << ";" << endl;
18-
}
19-
else {
20-
cout << "Negetive numbers cannot be applied !!!"<<endl;
21-
}
20+
}
21+
else
22+
{
23+
cout << "Negative numbers cannot be applied !!!" << endl;
24+
}
2225
system("pause");
2326
return 0;
2427
}

OOP1-Lab1/Source2.cpp renamed to OOP1-Lab1/EquilateralTriangle.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
//U1910049 Rustam Zokirov
2-
//Section 004
3-
//Assignment-2(Operators)
4-
//C++ program to Calculate Area of Equilateral Triangle
1+
// Rustam Zokirov
2+
// C++ program to Calculate Area of Equilateral Triangle
53

64
#include <iostream>
75
#include <math.h>
6+
87
using namespace std;
9-
int main2(){
8+
9+
int main()
10+
{
1011
cout << "\t\tC++ program to Calculate Area of Equilateral Triangle.\n ";
1112
float a, Area;
1213
cout << "Please enter the value for the side of Triangle: ";
1314
cin >> a;
14-
if (a > 0) {
15+
if (a > 0)
16+
{
1517
Area = sqrt(2) * a * a * 0.25;
1618
cout << "The Area of this triangle is " << Area << ";" << endl;
1719
}
18-
else {
20+
else
21+
{
1922
cout << "The sides of Triangle cannot be negative numbers ! " << endl;
2023
}
2124
system("pause");

OOP1-Lab1/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Practical Lab Assignment - Operators
2+
3+
1. C++ Program to Calculate Area and Circumference of Circle.
4+
2. C++ Program to Calculate Area of Scalene Triangle.
5+
3. C++ Program to Calculate Area of Equilateral Triangle.
6+
4. C++ Program to Calculate Area of Right angle Triangle.
7+
5. C++ Program to Calculate Area of Rectangle.
8+
6. C++ Program to Calculate Area of Square.

OOP1-Lab1/Source4.cpp renamed to OOP1-Lab1/Rectangle.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
//U1910049 Rustam Zokirov
2-
//Section 004
3-
//Assignment-2(Operators)
4-
//C++ program to Calculate Area of Rectangle
1+
// Rustam Zokirov
2+
// C++ program to Calculate Area of Rectangle
53

64
#include <iostream>
75
#include <math.h>
6+
87
using namespace std;
9-
int main4() {
8+
9+
int main()
10+
{
1011
cout << "\t\tC++ program to Calculate Area of Rectangle. " << endl;
1112
float a, b, Area;
12-
cout << "Please enter the length of Rectangle: " ;
13+
cout << "Please enter the length of Rectangle: ";
1314
cin >> a;
1415
cout << "Please enter the width of Rectangle: ";
1516
cin >> b;
16-
if (a > 0 && b > 0) {
17+
if (a > 0 && b > 0)
18+
{
1719
Area = a * b;
1820
cout << "The area of Rectangle is " << Area << ";" << endl;
1921
}
20-
else {
21-
cout << "The sides of Rectangle cannot be negetive numbers !" << endl;
22+
else
23+
{
24+
cout << "The sides of Rectangle cannot be negative numbers !" << endl;
2225
}
2326
system("pause");
2427
return 0;

OOP1-Lab1/Source3.cpp renamed to OOP1-Lab1/RightTriangle.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
//U1910049 Rustam Zokirov
2-
//Section 004
3-
//Assignment-2(Operators)
4-
//C++ program to Calculate Area of Right angle Triangle
1+
// Rustam Zokirov
2+
// C++ program to Calculate Area of Right angle Triangle
53

64
#include <iostream>
5+
76
using namespace std;
8-
int main3() {
7+
8+
int main()
9+
{
910
cout << "\t\tC++ program to Calculate Area of Right angle Triangle.\n ";
1011
float a, b, Area;
11-
cout << "Please enter the value for the first cathet of Triangle: " ;
12+
cout << "Please enter the value for the first cathet of Triangle: ";
1213
cin >> a;
13-
cout << "Please enter the value for the second cathet of Triangle: " ;
14+
cout << "Please enter the value for the second cathet of Triangle: ";
1415
cin >> b;
15-
if (a > 0 && b > 0){
16+
if (a > 0 && b > 0)
17+
{
1618
Area = b * a * 0.5;
1719
cout << "The Area of this Triangle is " << Area << ";" << endl;
1820
}
19-
else {
20-
cout << "The sides of Triangle cannot be negative numbers ! "<<endl;
21+
else
22+
{
23+
cout << "The sides of Triangle cannot be negative numbers ! " << endl;
2124
}
2225
system("pause");
2326
return 0;

OOP1-Lab1/Source1.cpp renamed to OOP1-Lab1/ScaleneTriangle.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
//U1910049 Rustam Zokirov
2-
//Section 004
3-
//Assignment-2(Operators)
4-
//C++ program to Calculate Area of Scalene Triangle
1+
// Rustam Zokirov
2+
// C++ program to Calculate Area of Scalene Triangle
53

64
#include <iostream>
75
#include <math.h>
6+
87
using namespace std;
9-
int main1() {
8+
9+
int main()
10+
{
1011
cout << "\t\tC++ program to Calculate Area of Scalene Triangle.\n";
1112
float a, b, c, S, Area;
1213
cout << "Please enter the values for the first side of Triangle: ";
13-
cin >> a ;
14+
cin >> a;
1415
cout << "Please enter the values for the second side of Triangle: ";
1516
cin >> b;
1617
cout << "Please enter the values for the third side of Triangle: ";
@@ -24,13 +25,15 @@ int main1() {
2425
cout << "The Area of Triangle is " << Area << endl;
2526
return 0;
2627
}
27-
else {
28-
cout << "This triangle is wrong try another values. " << endl;
28+
else
29+
{
30+
cout << "This triangle is wrong try another values." << endl;
2931
return 0;
3032
}
3133
}
32-
else {
33-
cout << "The sides of Triangle cannot be negative numbers !" << endl;
34+
else
35+
{
36+
cout << "The sides of Triangle cannot be negative numbers!" << endl;
3437
}
3538
system("pause");
3639
return 0;

OOP1-Lab1/Source5.cpp renamed to OOP1-Lab1/Square.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
//U1910049 Rustam Zokirov
2-
//Section 004
3-
//Assignment-2(Operators)
4-
//C++ program to Calculate Area of Square
1+
// U1910049 Rustam Zokirov
2+
// C++ program to Calculate Area of Square
53

64
#include <iostream>
75
#include <math.h>
6+
87
using namespace std;
9-
int main5() {
8+
9+
int main()
10+
{
1011
cout << "\t\tC++ program to Calculate Area of Square." << endl;
1112
float a, Area;
12-
cout << "Please enter the value for the side of Square: " ;
13-
cin >> a ;
14-
if (a > 0 ) {
15-
Area = a * a ;
13+
cout << "Please enter the value for the side of Square: ";
14+
cin >> a;
15+
if (a > 0)
16+
{
17+
Area = a * a;
1618
cout << "The area of Square is " << Area << ";" << endl;
1719
}
18-
else {
20+
else
21+
{
1922
cout << "Negetive numbers cannot be applied !!!" << endl;
2023
}
2124
system("pause");

OOP1-Lab1/Tasks.docx

-11.7 KB
Binary file not shown.

OOP1-Lab2/Greatestnumber.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
//U1910049
2-
//Lab assignment #3
3-
//Program to find greatest in 3 numbers
1+
// U1910049
2+
// Lab assignment #3
3+
// Program to find greatest in 3 numbers
44

55
#include <iostream>
66
using namespace std;
7-
int main2() {
7+
int main2()
8+
{
89
float a, b, c;
910
cout << "Enter the 3 numbres: ";
1011
cin >> a >> b >> c;
@@ -14,8 +15,8 @@ int main2() {
1415
cout << "The greatest number is " << b << ";" << endl;
1516
if (c >= a && c >= b)
1617
cout << "The greatest number is " << c << ";" << endl;
17-
else if(a==b==c)
18-
cout << "All numbers are equal."<< endl;
18+
else if (a == b == c)
19+
cout << "All numbers are equal." << endl;
1920
system("pause");
2021
return 0;
2122
}

OOP1-Lab2/Leap year.cpp renamed to OOP1-Lab2/LeapYear.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
1-
//Program to find that entered year is leap or not.
1+
// Program to find that entered year is leap or not.
2+
23
#include <iostream>
34
using namespace std;
4-
int main4() {
5+
6+
int main4()
7+
{
58
int year;
6-
cout << "Enter a Year: " ;
9+
cout << "Enter a Year: ";
710
cin >> year;
811
if (year % 4 == 0)
912
{
1013
if (year % 100 == 0)
1114
{
12-
if (year % 400 == 0) {
13-
cout << "Given " << year << " year is a leap."<< endl ;
15+
if (year % 400 == 0)
16+
{
17+
cout << "Given " << year << " year is a leap." << endl;
1418
}
15-
else {
19+
else
20+
{
1621
cout << "Given " << year << " year isn't a leap." << endl;
1722
}
1823
}
19-
else {
24+
else
25+
{
2026
cout << "Given " << year << " year is a leap year." << endl;
2127
}
2228
}
23-
else {
29+
else
30+
{
2431
cout << "Given " << year << " year isn't a leap." << endl;
2532
}
2633
system("pause");

0 commit comments

Comments
 (0)