the original form of header file included a .h suffix, e.g.
-
#include <iostream.h>
-
#include <fstream.h>
-
although this will still work it is now deprecated and replaced with
-
#include <iostream>
-
#include <fstream>
-
using namespace std;
-
I am not sure what would generate the other messages, could you post the code which gave them?
this is the source code that is generating the other messages
Assignment 2 Part II
- #include <iostream>
-
-
using namespace std;
-
-
const double PI = 3.141593;
-
-
int main();
-
{
-
double a, b, c;
-
double radius;
-
-
cout << "Enter the value of c: ";
-
cin >> c;
-
cout << endl;
-
-
cout << "Enter the value of a: ";
-
cin >> a
-
cout << endl;
-
-
cout << "Enter the value of b: ";
-
cin >> b;
-
cout << endl;
-
-
-
radius = a + b + c / 2 * PI;
-
-
cout << "The radius of the circle is: " << radius << endl;
-
-
Return 0
-
}
This is the second one I have a question on
I will insert the source code for it after the assignment. I'm not sure where to put then statements.
Assignment 2
Part I: Convert temperature from Fahrenheit to Celsius
Console will look like:
Welcome to the Temperature Converter
Enter degrees in Fahrenheit: 212
Degrees in Celsius: 100
Continue? (y/n): y
Enter degrees in Fahrenheit: 32
Degrees in Celsius: 0
Continue? (y/n): y
Enter degrees in Fahrenheit: 77.5
Degrees in Celsius: 25.28
Continue? (y/n): n
Press any key to continue . . .
Operation
• The application prompts the user to enter a temperature in Fahrenheit degrees.
• The application displays the temperature in Celsius degrees.
• The application prompts the user to continue.
Specifications
• The formula for converting temperatures from Fahrenheit to Celsius is:
c = (f-32) * 5/9
• The application should accept decimal entries like 77.5.
• Assume that the user will enter valid data.
• The application should continue only if the user enters “y” or “Y” to continue.
You will be graded on how well your program meets the following:
1. Use of meaningful data names.
2. Correct Logic.
3. Calculations are performed correctly.
4. Program does not terminate abnormally.
5. Submitted in a timely fashion.
6. Submitted with proper information.
7. No syntax errors.
8. Correct program format.
9. Comment the code.
Save the file as: asgn2xx.cpp (Where XX are your initials)
Due Date: Refer to your class information sheet
Once you are satisfied that your program functions correctly, submit to the digital drop box.
My Source code for temperature conversion
- #include<iostream.h>
-
#include <iomanip.h>
-
#include <stdlib.h>
-
-
using namespace std;
-
-
-
int main()
-
{
-
double degrees in Fahrenheit ;
-
double degrees in Celsius;
-
char y,n;
-
-
cout.setf(ios::fixed);
-
cout.setf(ios::showpoint);
-
cout.precision(2);
-
-
cout<<" Welcome to the Temperature Converter";endl
-
cout << "Enter degrees in Fahrenheit: ";
-
cin >> degrees in Fahrenheit;
-
cout << endl;
-
-
degrees in celsius = (degrees in farenheit- 32)* 5/9
-
cout << "degrees in celsius :" <<degrees in celsius << endl
-
-
cout<<" Continue ? ( Y/N):" ; endl
-
if (cin)= y then cout << setw(30) << ": Enter degrees in Fahrenheit: "; "
-
<< setw(12) << degrees in Fahrenheit << endl;
-
-
-
cout << setw(30) << ": Enter degrees in Fahrenheit: "; "
-
<< setw(12) << degrees in Fahrenheit << endl
-
system("PAUSE");
-
return 0;
-
}
//