// Program: name of program
// Author: your name
// Date Written: date you began writing the program
/* Abstract: Brief description of the program */
Include in-line comments in the body of your program.
You can convert temperature from degrees Celsius to degrees Fahrenheit by multiplying by 9/5 and adding 32. Write a C++ program that allows the user to enter a floating-point number representing degrees Celsius, and then displays the corresponding degrees Fahrenheit.
Algorithm (IPO chart, pseudocode or flowchart, desk check test data)
C++ program.
Screen shot of running program using test data from
---------------------------------------------------
No 2
At the top of every program program file you create, put the following as comments:
// Program: name of program
// Author: your name
// Date Written: date you began writing the program
/* Abstract: Brief description of the program */
Include in-line comments in the body of your program.
Write a working C++ program that calculates the values of the variables x, and y using the following formulas.
x = (b2- 4ac) / 2a
y = (-b + (b2- 4ac)) / 2a
For simplicity, assume a, b, and c are integers.
Prompt the user for initial values for a, b and c.
Accept values from user for a, b and c.
Choose appropriate data type for x and y.
Calculates the values for x and y based on user input for a, b and c and using the formulas provided.
Display the values of x and y to the user.
1 answer
// Author: Your Name
// Date Written: Date
/* Abstract: This program calculates the values of x and y using the formulas x = (b2- 4ac) / 2a and y = (-b + (b2- 4ac)) / 2a */
#include <iostream>
using namespace std;
int main()
{
// Declare variables
int a, b, c;
double x, y;
// Prompt user for values of a, b and c
cout << "Please enter values for a, b and c: ";
cin >> a >> b >> c;
// Calculate values of x and y
x = (b*b - 4*a*c) / (2*a);
y = (-b + (b*b - 4*a*c)) / (2*a);
// Display values of x and y
cout << "The value of x is: " << x << endl;
cout << "The value of y is: " << y << endl;
return 0;
}