Wednesday, October 6, 2021

Decimal, Whole Numbers, and Strings in C++

  Machine Problem

   Write a program that would ask 2 decimal numbers,  2 whole numbers and 3 shapes.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.




Program Listing

/* input.cpp

   Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

   www.jakerpomperada.com and www.jakerpomperada.blogspot.com

   jakerpomperada@gmail.com

   Bacolod City, Negros Occidental

   

   Machine Problem

   

    Write a program that would ask 2 decimal numbers,

2 whole numbers and 3 shapes.

*/


#include <iostream>

#include <iomanip>

#include <string.h>


int main()

{

double a=0.00,b=0.00;

int c=0,d=0;

char shape1[100],shape2[100],shape3[100];

std::cout <<"\n\n";

std::cout << "\tDecimal, Whole Numbers, and Strings in C++";

std::cout <<"\n\n";

std::cout << "\tEnter Two Decimal Numbers : ";

std::cin >> a >> b;

std::cout << "\tEnter Two Integer Numbers : ";

std::cin >> c >> d;

  std::cin.ignore(256, '\n');

std::cout << "\tEnter First Shape : ";

gets(shape1);

std::cout << "\tEnter Second Shape : ";

gets(shape2);

std::cout << "\tEnter Third Shape : ";

gets(shape3);

std::cout <<"\n\n";

std::cout <<"\tFirst Decimal Number  : " << a;

std::cout <<"\n";

std::cout << "\tSecond Decimal Number : " << b;

std::cout <<"\n";

std::cout << std::fixed << std::showpoint;

    std::cout << std::setprecision(2);

std::cout << "\n\n";

std::cout <<"\tFirst Integer Number  : " << c;

std::cout <<"\n";

std::cout <<"\tSecond Integer Number : " << d;

std::cout <<"\n\n";

std::cout <<"\tFirst Shape           : " << shape1;

std::cout <<"\n";

std::cout <<"\tSecond Shape          : " << shape2;

std::cout <<"\n";

std::cout << "\tThird Shape           : " << shape3;

std::cout <<"\n\n";

std::cout <<"\tEnd of Program";

std::cout <<"\n\n";

}

No comments:

Post a Comment