Off-topic Talk Where overpaid, underworked S2000 owners waste the worst part of their days before the drive home. This forum is for general chit chat and discussions not covered by the other off-topic forums.

Can all the computer programmers please read!!! I have a question for you.

Thread Tools
 
Old Jan 29, 2002 | 06:22 PM
  #1  
Shinji's Avatar
Thread Starter
Registered User
 
Joined: Jul 2001
Posts: 1,985
Likes: 0
Default Can all the computer programmers please read!!! I have a question for you.

I just took this computer programming course and I do not understand the C language at all. Can someone help me out and type up a source code for me that runs on Borlands C++. I know this is bad for me but C++ is very abstract to me. It's a piece of cake to the master programmers out there. Help would be appreciated!

Temperatures are given in Fahrenheit and Celsius units. The conversion equation is celsiusValue = 5/9(fahrenheitValue - 32)

Write a complete program that prompts for input of a Fahrenheit temperature and outputs the equivalent Celsius value.

Sample:
Input: Enter Fahrenheit temperature, 98.6
Output: Celsius temperature is 37.0
Reply
Old Jan 29, 2002 | 06:57 PM
  #2  
TimTheFoolMan's Avatar
 
Joined: Nov 2001
Posts: 432
Likes: 0
From: Louisville
Default

[QUOTE]Originally posted by RSXTypeR
[B]I just took this computer programming course and I do not understand the C language at all.
Reply
Old Jan 29, 2002 | 08:56 PM
  #3  
Shinji's Avatar
Thread Starter
Registered User
 
Joined: Jul 2001
Posts: 1,985
Likes: 0
Default

I didn't really expect a reply or answer from someone. I though it would just be a flame war for me to do my own hw. HEHE thanks Tim! Yes I think it is a "object-oriented C++ program." I compiled this with Visual C++ with no errors do you think there's any problems here Tim? How do I run this thing? Yes I know you're going to make fun of me for my unintelligent comments, but my prof. force me to put them there. Will this run if it compiles with no errors? And when I define the integer C is it correctly stated? Do spacing between: *+-/%, matter? Thanks a lot!

// CS107 - Spring 2002 - Assignment #2 - Wed 9 am

// define cin and cout stream objects
#include <iostream.h>

int main()
{
int f, c;

// prompt for integer
cout << "Enter Fahrenheit temperature,";
cin >> f; // read integer f

c = (5 / 9) * (f - 32); // defines integer

cout << "Celsius temperature is " << c; // outputs conversion

return 0;
}
Reply
Old Jan 29, 2002 | 09:52 PM
  #4  
cthree's Avatar
Administrator
20 Year Member
 
Joined: Oct 2000
Posts: 20,274
Likes: 4
From: Toronto, Canada
Default

or

// CS107 - Spring 2002 - Assignment #2 - Wed 9 am

// define cin and cout stream objects
#include <iostream.h>

int main(int, char**)
{
int f;

// prompt for integer
cout << "Enter Fahrenheit temperature,";
cin >> f; // read integer f

cout << "Celsius temperature is " << (5 / 9) * (f - 32); // outputs conversion

return 0;
}
Reply
Old Jan 29, 2002 | 10:18 PM
  #5  
SpEeDxXxRaCeR's Avatar
Registered User
 
Joined: Oct 2001
Posts: 3,230
Likes: 0
From: Sugar Land
Default

[QUOTE]Originally posted by cthree
[B]

int main(int, char**)
Reply
Old Jan 29, 2002 | 10:19 PM
  #6  
mrkim019's Avatar
Registered User
20 Year Member
 
Joined: Dec 2000
Posts: 4,136
Likes: 0
From: Saratoga
Default

if you want C....since those guy wrote C++...i thought i read "in C"

void main()
{
int f, c;
printf("Enter Fahrenheit temp");
scanf("%lf", &f);
c = ((5/9) * (f - 32));

printf("Celcius Temp is %f", c);

}


Reply
Old Jan 29, 2002 | 11:50 PM
  #7  
Shinji's Avatar
Thread Starter
Registered User
 
Joined: Jul 2001
Posts: 1,985
Likes: 0
Default

This is getting beyond my knowledge, if I copied any of the things you guys wrote I would be expelled from my college for plagarism. HEHE Just wanted to know whether the source code I have right now works or not?
Reply
Old Jan 30, 2002 | 04:52 AM
  #8  
awinskill's Avatar
Registered User
 
Joined: Mar 2001
Posts: 1,723
Likes: 0
From: Watford
Default

Oh go on then..... (In Java )

package RSXTypeR;
import RSXTypeR.numberConvert.*;

import java.io.*;

public class RSXTypeRHomeWork {

public static void main(String[] args)
{

System.out.print("Enter temp in F : ");

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input = reader.readLine();

TemperatureConverter tc = new tc(input, tc.FAHRENHEIT );
System.out.println("Temperature in Celcius: " + tc.celcius());
}
}


Now then RSX, implement the class TemperatureConverter.....
Reply
Old Jan 30, 2002 | 05:12 AM
  #9  
Shinji's Avatar
Thread Starter
Registered User
 
Joined: Jul 2001
Posts: 1,985
Likes: 0
Default

Now going into Java... this'll get me arrested!
Reply
Old Jan 30, 2002 | 05:22 AM
  #10  
TimTheFoolMan's Avatar
 
Joined: Nov 2001
Posts: 432
Likes: 0
From: Louisville
Default

[QUOTE]Originally posted by SpEeDxXxRaCeR
[B]I forgot what the asteriks do?
Reply



All times are GMT -8. The time now is 10:28 PM.