Thread: Take a look at this program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I'm less than sure.... abyssphobia's Avatar
    Join Date
    Aug 2004
    Posts
    112

    Take a look at this program

    Well a friend sent me this code and ask me if I can figure out what is wrong, but the proble is I donno C, I barely understood the instructions, its totally different to C++, well if someone knows Ill be glad.
    Code:
    #include<stdio.h> 
    #include<conio.h> 
    #include<string.h> 
    
    void main() 
    { 
    	float tmp,c,k,f;
    	int grd;
    	printf("\n\r How grade you want?\r 1.-Celcius \n\r 2.-Farenheit \n\r 3.-Kelvin");
    	scanf("\n\r %i",&grd);
    	scanf("\n\r %f",&tmp);
    	if (grd==1)
    	{
    		f=(tmp*1.8)+32;
    		k= tmp+273;
    		printf("\n\r Farenheit%f Kelvin%f",&f,&k);
    	}
    	if (grd==2)
    	{
    		c= (tmp-32)/1.8;
    		k= c+273;
    	}
    	if (grd==3)
    	{
    		c= tmp-273;
    		f= (c*1.8)+32;
    
    	}
    	
    
    	}
    Last edited by abyssphobia; 08-31-2004 at 12:50 AM.
    Have I crossed the line?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM