C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Intel® Graphics Performance Analyzers is a powerful tool suite for analyzing and optimizing your games, media, and graphics-intensive applications. Used by some of the best developers on the planet, Intel GPA lets you maximize your app’s performance.


Tutorials
| Forums

Download to Enter
| Contest Rules

DOWNLOAD INTEL® GPA FOR FREE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 21st, 2003, 05:12 PM
gman932 gman932 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 53 gman932 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 19 sec
Reputation Power: 9
no output code just returns to prompt

I am running some C code on a unix system using a gnut (gcc file.c) compiler and i'm having troubles. The program just returns to prompt without displaying the output.

Code:
#include<stdio.h>

double round (double);

int main(void)  {
 double orig;
 double six;


printf("\nEnter a floating point number to be rounded: ");
scanf("%lf",&orig);

/*+___conversions___+*/
six = (orig * 100000.0 + 0.5)/ 100.0;

printf("\n %lf rounded on the fourth decimal place is %lf.", six, round(orig));

return(0);
}

    double round (double num)  {

        num = (num * 1000.0+0.5)/ 100.0;

        return num;
}


I have wasted like hours upon hours trying to figure it out. I have changed things around and fooled with it. It would make sense that the error would be somewhere before the second printf statement but I can't find anything. Please let me know if you find a misstake or if i'm doing something wrong.

-gman932

Reply With Quote
  #2  
Old September 21st, 2003, 09:04 PM
mitakeet's Avatar
mitakeet mitakeet is offline
I'm Baaaaaaack!
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jul 2003
Location: Maryland
Posts: 5,319 mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level)mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level)mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level)mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level)mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level)mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level)mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level)mitakeet User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 2 Days 22 h 4 m 31 sec
Reputation Power: 212
Your code compiles and runs find on my VC++ 6. Try another compiler (most *nixs have 'cc' for plain C code).
__________________

My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
Free code: http://sol-biotech.com/code/.
Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
--Me, I just made it up

The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
--George Bernard Shaw

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > no output code just returns to prompt


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap