Your browser does not seem to support CSS. If images appear below, please disregard them.
It appears that you're running an Ad-Blocker. This site is monetized by Advertising and by ">User Donations; we ask that if you find this site helpful that you whitelist us in your Ad-Blocker, or make a ">Donation to help aid in operating costs.
Previous Thread
Next Thread
Print Thread
Rate This Thread
#17146 - 04/20/04 10:04 AM c functions and calls  
Joined: Apr 2004
Posts: 6
geodesic Offline
Junior Member
geodesic  Offline
Junior Member

Joined: Apr 2004
Posts: 6
The Riemann Manifold
hello,

please take a look at the following code and give me some feedback on

1. does it reflect "good programming style"
2. is it "portable"
3. is it "elegant"

i am learning this c language and would love feedback.

so far you guys have been a great help. i want to get up to speed on this programming stuff asap. i got a graphlink for my ti - 83+ graphing calc and wanna get into some assembly with it .. but thats a whole other topic ....

so heres the code ...

Code
 
float celsius_conversion(float fahr);
float kelvin_conversion(float celsius);


float fahr, celsius, kelvin;

int main(void)
{
	

	printf ("\nPlease enter the temperature in Farenheit\n");
	printf ("that you wish to convert to Celsius and Kelvin: ");
	scanf (" %f", &fahr);
	celsius = celsius_conversion(fahr);
	printf("\n%.1f Degrees Farenheit is:\n\n1. %.1f Degrees Celsius\n2. %.1f Kelvin",
	fahr, celsius_conversion(fahr), kelvin_conversion(celsius));
	
	return 0;
}

float celsius_conversion(float fahr)
{   
    
	celsius = (5 * (fahr -32)/9);
	
	return celsius;
	
}

float kelvin_conversion(float celsius)
{
	kelvin = celsius + 273.15;
	
	return kelvin;
	
}		
	 

Sponsored Links
#17147 - 04/27/04 11:04 AM Re: c functions and calls  
Joined: Aug 2003
Posts: 68
MESELF Offline
Junior Member
MESELF  Offline
Junior Member

Joined: Aug 2003
Posts: 68
yes assembly is a whole other topic. esp for ti-83+. i know a little o' that stuff it is anal. that code looks alright to me. i would say its pretty good programming style. elegance dont ask me about that and i know nothing of porting. but the code itself is functional and its a nice illustration of functions for a beginner.


Member Spotlight
Gremelin
Gremelin
Portland, OR; USA
Posts: 7,198
Joined: February 2002
Show All Member Profiles 
Forum Statistics
Forums45
Topics33,913
Posts69,055
Members2,164
Average Daily Posts3
Members2,164
Most Online1,567
Apr 25th, 2010
Latest Postings
shopping for jewelry with something above
by mikejoey on 04/12/17 08:01 AM
PANDORA North The usa
by mikejoey on 04/12/17 07:38 AM
Pandora’s birthstone products will always
by mikejoey on 04/12/17 07:14 AM
the newest Pandora necklaces crafting facility
by mikejoey on 04/12/17 06:53 AM
an Air Jordan 4 by Off White is in
by mikejoey on 04/12/17 06:35 AM
belonging to the adidas NMD XR1
by mikejoey on 04/12/17 05:50 AM
Other detailsThe adidas Originals Celebrity
by mikejoey on 04/12/17 05:35 AM
The DNA on the NMD model is actually
by mikejoey on 04/12/17 05:18 AM
in which adidas NMD XR1 “Zebra” supplying
by mikejoey on 04/12/17 04:05 AM
Blackbeard.....
by Gremelin on 01/14/17 07:03 PM
Top Posters(All Time)
UGN Security 41,138
Gremelin 7,198
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Liked Users (All Time)
§intå× Likes: 3
Black Beard Likes: 1
Cold Sunn Likes: 1
Crime Likes: 1
Cyrez Likes: 1
fleshwound Likes: 1
Ghost Likes: 2
Gremelin Likes: 12
Ice Likes: 1
ninjaneo Likes: 1
Top Liked Users (30 Days)
No Data Found
Powered by UBB.threads™ PHP Forum Software 7.6.0
(Snapshot build 20170206)