473,326 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Temperature Conversion programming

I am taking an online C++ Class and I am having trouble with the compiler . I typed in my source code and am trying to debug , But the problem is being that I am so new to this I don't understand what correction the compiler is instructing me to make. What does it mean when it says deprecated or antiquated header or missing function header or newline in constant
Feb 12 '07 #1
7 2662
horace1
1,510 Expert 1GB
I am taking an online C++ Class and I am having trouble with the compiler . I typed in my source code and am trying to debug , But the problem is being that I am so new to this I don't understand what correction the compiler is instructing me to make. What does it mean when it says deprecated or antiquated header or missing function header or newline in constant
the original form of header file included a .h suffix, e.g.
Expand|Select|Wrap|Line Numbers
  1. #include <iostream.h>
  2. #include <fstream.h>
  3.  
although this will still work it is now deprecated and replaced with
Expand|Select|Wrap|Line Numbers
  1.  #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
I am not sure what would generate the other messages, could you post the code which gave them?
Feb 12 '07 #2
the original form of header file included a .h suffix, e.g.
Expand|Select|Wrap|Line Numbers
  1. #include <iostream.h>
  2. #include <fstream.h>
  3.  
although this will still work it is now deprecated and replaced with
Expand|Select|Wrap|Line Numbers
  1.  #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
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

Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const double PI = 3.141593;
  6.  
  7. int main();
  8.  {
  9.     double a, b, c;
  10.     double radius;
  11.  
  12.     cout << "Enter the value of c: ";
  13.     cin >> c;
  14.     cout << endl;
  15.  
  16.     cout << "Enter the value of a: ";
  17.     cin >> a
  18.     cout << endl;
  19.  
  20.     cout << "Enter the value of b: ";
  21.     cin >> b;
  22.     cout << endl;
  23.  
  24.  
  25.     radius = a + b + c  /  2 * PI;
  26.  
  27.     cout << "The radius of the circle is: " << radius << endl;
  28.  
  29.     Return 0
  30. }




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
Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include <iomanip.h>
  3. #include <stdlib.h>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10.     double degrees in Fahrenheit ;
  11.     double degrees in Celsius;
  12.     char y,n;
  13.  
  14.    cout.setf(ios::fixed);
  15.    cout.setf(ios::showpoint);
  16.    cout.precision(2);
  17.  
  18.     cout<<" Welcome to the Temperature Converter";endl
  19.     cout << "Enter degrees in Fahrenheit: "; 
  20.     cin >> degrees in Fahrenheit;
  21.     cout << endl;
  22.  
  23.     degrees in celsius  = (degrees in farenheit- 32)* 5/9
  24.     cout << "degrees in celsius :" <<degrees in celsius << endl
  25.  
  26.     cout<<" Continue ? ( Y/N):" ; endl
  27.     if (cin)= y then cout << setw(30) << ": Enter degrees in Fahrenheit: "; "
  28.             << setw(12) << degrees in Fahrenheit << endl;
  29.  
  30.  
  31. cout << setw(30) << ": Enter degrees in Fahrenheit: "; "
  32.             << setw(12) << degrees in Fahrenheit << endl
  33.                    system("PAUSE");
  34.     return 0;
  35. }


//
Feb 14 '07 #3
horace1
1,510 Expert 1GB
this compiles now - check that it works!
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const double PI = 3.141593;
  6.  
  7. int main()  //  removed;
  8.  {
  9.     double a, b, c;
  10.     double radius;
  11.  
  12.     cout << "Enter the value of c: ";
  13.     cin >> c;
  14.     cout << endl;
  15.  
  16.     cout << "Enter the value of a: ";
  17.     cin >> a;  // added ;
  18.     cout << endl;
  19.  
  20.     cout << "Enter the value of b: ";
  21.     cin >> b;
  22.     cout << endl;
  23.  
  24.  
  25.     radius = a + b + c  /  2 * PI;
  26.  
  27.     cout << "The radius of the circle is: " << radius << endl;
  28.  
  29.     return 0;
  30. }
  31.  
Feb 15 '07 #4
tHANKS FOR ALL YOUR HELPP
Feb 28 '07 #5
Ganon11
3,652 Expert 2GB
If you still have questions regarding you temperature conversion, feel free to post a new thread, and we can help you with it.
Feb 28 '07 #6
If you still have questions regarding you temperature conversion, feel free to post a new thread, and we can help you with it.
It's all done thanks
Im' still struggling with my new assignment concerning odd numbers and a while loop. It's titled while loop
Mar 2 '07 #7
r035198x
13,262 8TB
It's all done thanks
Im' still struggling with my new assignment concerning odd numbers and a while loop. It's titled while loop
Renamed thread
Mar 2 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Derek Ross | last post by:
Hello, Say I have a server that's saving the CPU temperature to 'temperature.js' once a second. The contents of the file is one single line: var temperature = "35.5"; And it changes as...
6
by: Thomas Barth | last post by:
Hi, I'm new to windows programming and still reading a book about windows-programming with C++. I copied the following code from the book into my ide (Eclipse/CDT) to comprehend the code, but two...
1
by: deanfamily11 | last post by:
I'm trying to have this program do a simple temperature conversion from Fahrenheit to Celsius. I have confirmed that the other variable is receiving and calculating the conversion, but it is just...
5
by: anthony | last post by:
One the computer I am programmig I could see the CPU temperature in the BIOS, is there a system DLL in VB.NET that I can call to display the temperature in my software? Thanks!
2
by: adeebraza | last post by:
My Dear I want to control temperature of an oven through PC's parallel port LPT-1 and using VB-6. I have already developed an interface for inputting 8 Bit digital temperature to my PC through...
1
by: pollardw | last post by:
i have written a small program to convert Fahrenheit to Celsius and I have a minor problem. Here is the code what do i need to change to get it to work? /* Convert Fahrenheit to Celsius */ ...
4
by: arnuld | last post by:
this is my final code. Can you folks advise some improvements for making this programme better? BTW, i aways compile my programme with this cmmand on Linux: g++ -ansi -pedantic -Wall -Wextra...
21
by: AsheeG87 | last post by:
Hey Everyone~ I'm still a C++ Rookie so please bear with me on this. I'm doing a temperature conversion program with prototype functions. Basicly, I was wondering if some of you would take a look...
16
by: Brigitte Behrmann | last post by:
I am absolutely stuck with this one. I have to create a temperature conversion calculator that rounds the resulting temperature to the nearest whole number & vice versa. The result must be displayed...
25
by: kid joe | last post by:
Hi, Is it normal for the temperature of your CPU to increase as time goes on? I've got an Athlon XP 2100+ and I see that the temp is now at 51C where it used to be around 42 to 44. Anyone...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.