High Point Question Flashcards
Given in class
Write a program that accepts a Fahrenheit temperature and outputs the equivalent centigrade temperature,
a.use a function to receive the Fahrenheit temperature
b. caculate the value in centigrade
c.return the centigrade value for display in the main
d.have the program continue until the user is finished using it
Celcuis=5/9*(Fahrenheit-32)
include <iostream></iostream>
using namespace std;
[double convert(double);
int main()
{
double fah;
double cel;
count«“Enter fahernite”;
cin»fah;
cel=convert(fah);
count«cel;
}
double convert(double f)
{
double celcuis;
celcuis=(5.0/9.0)*(f-32);
return celcuis;
}
Write a program that will ask the user to enter two numbers
-the program should pass those number to a function called high low
-in the the function use the conditional operator(if,else if,else) to determine which number is the smaller and which is the larger or if they are equal;l
-ha ve the program continue until the user is finished using it
include <iostream></iostream>
using namespace std;
[void compare it(int,int);
int main()
{
int num1;
int num2;
cout «“Enter value number 1:”;
cin»num1;
cout«“Enter value number 2:”;
cin»num2;
compareIt(num1,num2);
}
void compareIt(int a,int b)
{
if(a>b)
cout«“a is bigger”);
else if(a<b)
cout«“b is bigger”;
else
cout,,”values are the same”;
}