Thread: float input

  1. #1
    Registered User
    Join Date
    Jan 2009
    Location
    Hamilton, Canada
    Posts
    2

    float input

    well i have a similar but a bit different problem .
    i am using visual c++ , ver 6.0 .
    when i execute this code it wont take float input ??
    i have tried debugging it says 'no return address"

    Code:
    case 2 :	{
    	printf("\n Set laser pulse delay stepping from 1.25ns to 0.25ns : ");
                    scanf("%f", &ds);
    	delaa(); // just a delay function
    	break;
    	}
    
    // all the other cases work fine ???

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Split from http://cboard.cprogramming.com/showthread.php?t=110458

    You're going to have to post more code than that.
    Ideally, something which compiles.
    For example, what type is ds?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Is there a specific reason you use VS6? Can you upgrade to a more modern compiler?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Location
    Hamilton, Canada
    Posts
    2
    Here's the begining of the code:


    Code:
    #include "stdafx.h" // it contains all the headers .
    
    
    int usrchoice(void); // takes input for defining parameters for otdr opration
    void delaa(void); // just a delaa function
    unsigned long pw;
    float ds = 0.0;
    unsigned int il;
    double avg;
    
    main( )
    {
    
    	while(1)
    	{
    		// get user selection and branch to that task.
    		switch(usrchoice())
    		{
    
    					case 1 :
    						{
    							printf("\n Set laser pulse width b/w 10ns to 1000ns(10us) : ");
    							scanf("%d", &pw);
    							delaa();
    							break;
    						}
    
    
    					case 2 :
    						{
    							printf("\n Set laser pulse delay stepping from 1.25ns to 0.25ns : ");
    							scanf("%f", &ds);
    							delaa();
    							break;
    						}

    when it is run it and takes input on case 2 , it comes up with runtine error ???
    Last edited by Asimghouri; 01-13-2009 at 03:10 PM. Reason: more info

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  2. Debug Error Really Quick Question
    By GCNDoug in forum C Programming
    Replies: 1
    Last Post: 04-23-2007, 12:05 PM
  3. Replies: 6
    Last Post: 11-12-2005, 11:57 AM
  4. Could somebody please help me with this C program
    By brett73 in forum C Programming
    Replies: 6
    Last Post: 11-25-2004, 02:19 AM
  5. Why does it work in Visual Studio and Not Borland
    By MonteMan in forum C++ Programming
    Replies: 14
    Last Post: 10-20-2002, 09:36 PM