Question

In: Computer Science

Create a C++ program that consists of the following: In maincreate the following three variables:...

Create a C++ program that consists of the following: In main create the following three variables: A char named theChar A double named theDouble An int named theInt Fill each of these variables with data taken as input from the keyboard using a single cin statement. Perform the following task on each variable: Increment theChar by one Decrement theDouble by two Square theInt This should be done on separate lines. Output the value of each variable to the screen on separate lines using cout statements. Your program should also output the name of the variable followed by a colon.

Solutions

Expert Solution

#include

#include

using namespace std;

int main()

{

//Declaring variables

char theChar;

double theDouble;

int theInt;

  

//Getting the input entered by the user

cout<<"Enter the inputs :";

cin>>theChar>>theDouble>>theInt;

  

//Performing operations

theChar+=1;

theDouble-=1;

theInt=pow(theInt,2);

  

//Displaying the output

cout<<"theChar :"<

cout<<"theDouble :"<

cout<<"theInt :"<

return 0;

}

___________________

Output:


Related Solutions

1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables:...
1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables: StudentName (string), SchoolYear (int), YearsUntilGraduation(int) * Method YTK() = 12 - SchoolYear; 2. Main *Enter name *Enter age *You will attend school:____ years before graduating.
Using C++ language, create a program that uses a struct with array variables that will loop...
Using C++ language, create a program that uses a struct with array variables that will loop at least 3 times and get the below information: First Name Last Name Job Title Employee Number Hours Worked Hourly Wage Number of Deductions Claimed Then, determine if the person is entitled to overtime and gross pay. Afterwards, determine the tax and net pay. Output everything to the screen. Use functions wherever possible. Bonus Points: Use an input file to read in an unknown...
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class...
C++ Programming Create a C++ program program that exhibits polymorphism. This file will have three class definitions, one base class and three derived classes. The derived classes will have an inheritance relationship (the “is a” relationship) with the base class. You will use base and derived classes. The base class will have at least one constructor, functions as necessary, and at least one data field. At least one function will be made virtual. Class members will be declared public and...
Problems create a C++ program that will do the followings - define 3 double variables x,...
Problems create a C++ program that will do the followings - define 3 double variables x, y, z - calculate the value of y as the following formula: y = 2*x*x+4*x+5 and print x and y; - assign a new value to x: x=5.6 - calculate the value of z as the following formula z = (y*y)/4 + (x*x)/5 - print x, y,x
In C++, Create a program that can try out every possible logical combination of the variables...
In C++, Create a program that can try out every possible logical combination of the variables A, B, and C, and determine which combinations will yield a true statement. Take note that there are eight different possible combinations of the three variables. Make certain you test all eight of the combinations. (1) (A and B) or (A and C) (2) (A and C) and (B and !C) (3) (A or B) and !(B or C) (4) (A or (!A and...
Using C#: Create a Form that consists of 4 checkboxes, three radio buttons, a label and...
Using C#: Create a Form that consists of 4 checkboxes, three radio buttons, a label and a button. The 4 checkboxes represent pizza toppings. The three radiobuttons should represent three sizes of pizza, namely “small”, “medium” and “large”. When the user clicks the button you need to calculate the price of the pizza. The calculation should be done as follows: count up the cost of the selected ingredients (you may assign your own prices for the ingredients) and then multiply...
Create a C program that performs the following (please comment the codes): a) Create a Stack...
Create a C program that performs the following (please comment the codes): a) Create a Stack ADT. Stack should be implemented using the linked list. b) Enter 10 random integer numbers between 0 to 50 in the stack. c) After pushing each element, print the content of the top of the stack. c) Then pop out those 10 integer numbers and print those numbers. d) Finally destroy the Stack.
reate a C# program. -Create 5 variables as decimals: Count, pricce, subtotal, tax, and total -Use...
reate a C# program. -Create 5 variables as decimals: Count, pricce, subtotal, tax, and total -Use a do while loop. If the price is not -1, the loop continues. Show count number (ie: Item 1, Item 2, Item 3...) Enter price Get subtotal Increase count -Calculate tax(0.035%) and total Show total count, subtotal, tax,and total Output: Item1: $2.00 Item2:: $3.00 Item3: $1.00 Item4: $-2 (Note: A negative number will not be substracted. It will only be ignored) There are 3...
I am trying to create a makefile for the following program in Unix. The C++ program...
I am trying to create a makefile for the following program in Unix. The C++ program I am trying to run is presented here. I was wondering if you could help me create a makefile for the following C++ file in Unix and show screenshots of the process? I am doing this all in blue on putty and not in Ubuntu, so i don't have the luxury of viewing the files on my computer, or I don't know how to...
In java Create a program to calculate interest rate and total balance - the program consists...
In java Create a program to calculate interest rate and total balance - the program consists of (a) A class that encapsulates the interest rate and total balance calculation Constructor should accept initial balance and interest rate Methods: Returns interest rate Returns total balance Set interest rate Set initial balance (b) A test program that uses class from step (A) to perform the following: Set interest rate to 5% and initial balance to 1000 Print interest amount and total balance...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT