Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void LargestNumber(int x, int y, int z) {
- if ((x > y) && (x > z)) {
- cout << "Largest is: " << x << endl;
- }
- else if ((y > x) && (y > z)) {
- cout << "Largest is: " << y << endl;
- }
- else {
- cout << "Largest is: " << z << endl;
- }
- }
- void SmallestNumber(int x, int y, int z) {
- if ((x < y) && (x < z)) {
- cout << "Smallest is: " << x << endl;
- }
- else if ((y < x) && (y < z)) {
- cout << "Smallest is: " << y << endl;
- }
- else {
- cout << "Smallest is: " << z << endl;
- }
- }
- void IsLargerOrEqual() {
- int x, y;
- cout << "Please enter the value of x: ";
- cin >> x;
- cout << "Please enter the value of y: ";
- cin >> y;
- if (y == x) {
- cout << "x is equal to y.";
- }
- else if (x > y) {
- cout << "x is larger than y.";
- }
- else
- {
- cout << "y is larger thatn x.";
- }
- }
- void SquareCube() {
- cout << "Interger " << "Square " << " Cube " << endl;
- for (int i = 1; i < 11; i++) {
- cout << i << " " << i * i << " " << i * i * i << endl;
- }
- }
- void CalculateBMI(double weight, double height) {
- double bmi = (weight * 703) / (height * height);
- cout << "BMI VALUES\n" << "Underweight: less than 18.5\n" << "Normal : between 18.5 and 24.9 \n"
- << "Overweight : between 25 and 29.9\n" << "Obese : 30 or greater\n" << "Your BMI is: " << bmi << endl;
- }
- void CalculateGasCost() {
- double gallonsPerDay, gallonCost, parkingCost, tollsCost;
- cout << "Please enter below values : \n" << "Number of gallons per day: \n";
- cin >> gallonsPerDay;
- cout << "The cost per gallons: \n";
- cin >> gallonCost;
- cout << "Parking cost: \n";
- cin >> parkingCost;
- cout << "Please enter the tolls cost \n";
- cin >> tollsCost;
- double totalCostPerDay = 0;
- totalCostPerDay = (gallonsPerDay * gallonCost) + parkingCost + tollsCost;
- cout << "Your total cost per day is : " << totalCostPerDay << endl;
- }
- void DrawingASquare() {
- cout << "* * * * * * * * * " << endl;
- int spaces = 2;
- int stars = 1;
- for (int i = 0; i < 5; i++) {
- for (int j = 0; j < stars; j++) {
- cout << "*";
- }
- for (int j = 0; j < spaces; j++) {
- cout << " ";
- }
- for (int j = 0; j < stars; j++) {
- cout << "*";
- }
- cout << endl;
- }
- cout << "* * * * * * * * * " << endl;
- }
- void DrawingTShape() {
- int spaces = 3;
- int stars = 1;
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < spaces; j++) {
- cout << " ";
- }
- spaces--;
- for (int j = 0; j < stars; j++) {
- cout << "*";
- }
- cout << endl;
- stars += 2;
- }
- int spaces1 = 3;
- int star = 1;
- for (int i = 0; i < 7; i++) {
- for (int j = 0; j < spaces1; j++) {
- cout << " ";
- }
- for (int j = 0; j < star; j++) {
- cout << "*";
- }
- cout << endl;
- }
- }
- void DrawingADiamond() {
- int spaces1 = 7;
- int star = 1;
- int spaces2 = 0;
- for (int i = 0; i < 6; i++) {
- for (int j = 0; j < spaces1; j++) {
- cout << " ";
- }
- cout << "*";
- spaces1--;
- for (int j = 0; j < spaces2; j++) {
- cout << " ";
- }
- cout << "*";
- spaces2 += 2;
- cout << endl;
- }
- for (int i = 0; i < 6; i++) {
- for (int j = 0; j < spaces1; j++) {
- cout << " ";
- }
- spaces1++;
- cout << "*";
- for (int j = 0; j < spaces2; j++) {
- cout << " ";
- }
- cout << "*";
- spaces2 -= 2;
- cout << endl;
- }
- cout << " *" << endl;
- }
- int main(){
- //int x, y, z;
- //cout << "Please enter three numbers: " << endl;
- //cin >> x >> y >> z;
- ////IsLargerOrEqual();
- //LargestNumber(x,y,z);
- //SmallestNumber(x,y,z);
- //cout << "The sum : " << x + y + z << endl;
- //cout << "The product : " << x * y * z << endl;
- //cout << "The average : " << (x + y + z) / 3 << endl;
- /* double radius;
- const double x = 3.14159;
- cout << "Please enter the radius : " << endl;
- cin >> radius;
- cout << "The diameter : " << radius * 2 << endl;
- cout << "The circumference : " << (radius * 2) * x << endl;
- cout << "The area " << (radius * radius) * x << endl;*/
- /* int numstars{};
- std::cin >> numstars;
- for (int i = 0; i < numstars; ++i)
- cout << string(numstars, '*') << '\n';*/
- /*int number, n1, n2, n3, n4, n5;
- cout << "Please enter a 5 digis number: " << endl;
- cin >> number;
- n1 = number % 10;
- number = number / 10;
- n2 = number % 10;
- number = number / 10;
- n3 = number % 10;
- number = number / 10;
- n4 = number % 10;
- number = number / 10;
- n5 = number % 10;
- cout << n5 << " " << n4 << " " << n3 << " " << n2 << " " << n1 << " " << endl;
- cout << "**~~**~~**~~***~~**~~**~~**" << endl;*/
- //SquareCube();
- //CalculateBMI(180, 64.5);
- //CalculateGasCost();
- DrawingASquare();
- DrawingTShape();
- DrawingADiamond();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement