UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
December
Su M Tu W Th F Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Our Sponsors


Latest Postings
My friend NEEDS your HELP!
by Gizmo
11/26/08 12:21 AM
Useful PHP Functions & Code
by Gizmo
11/13/08 09:25 PM
UBBCode Tags
by Gizmo
11/13/08 09:25 PM
Topic Options
Rate This Topic
#17146 - 04/20/04 06:04 AM c functions and calls
geodesic Offline
Junior Member

Registered: 04/18/04
Posts: 6
Loc: 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;
	
}		
	 

Top
Our Sponsors
Sponsor Our Sponsors

Sponsor Advertisements help keep UGN Security Online.



Support UGN Security by Purchasing our Sponsors Products.
Top  
#17147 - 04/27/04 07:04 AM Re: c functions and calls
MESELF Offline
Junior Member

Registered: 08/08/03
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.

Top



Featured Member
Registered: 03/03/02
Posts: 23
Forum Stats
6889 Members
44 Forums
11030 Topics
45809 Posts

Max Online: 677 @ 06/30/07 10:06 PM
Top Posters
Gizmo 6958
UGN Security 4080
§intå× 3252
IceMyst 1449
SilentRage 1273
Ice 1146
pergesu 1134
Infinite 1039
jonconley 954
Girlie 903
Newest Members
lucky vin, prEttyNDistress, AndrewKlilly, border, f4k3m3
6889 Registered Users
Who's Online
0 registered (), 6 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Latest News
Update Humpday - Sept 26, 2008
by Gizmo
11/28/08 03:39 AM
Happy Holidays!
by Gizmo
11/27/08 09:09 AM
New Mailing
by Gizmo
11/24/08 01:30 PM
A special update...
by Gizmo
11/24/08 01:10 PM
Required Reading Update...
by Gizmo
11/07/08 11:36 AM


Donate
  Get Firefox!
Get FireFox!