Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikeyredk

macrumors 65816
Original poster
Mar 13, 2003
1,267
1
i want to test my logic before i continue but i keep getting an error after i key in the numbers i really need some help im the only mac user in the class remember its not totally done just want to test some logic

here is the photo of the first error
Picture%201.jpg


if i go into the debug i keep getting bumbed into some other function
__pow_helper() and it gets stuck

Code:
// includes
#include <iostream.h>
// defines
#define SKIPLINE cout<<endl
void arrange(double,double,double);
///////////////////////////////////////////////////////////////////
//  Programmer:         Manoj Aggarwal
//  Date Due:           October 19, 2003
//  Input:              three values
//  Process:            arrange three values
//  Output:             three values arranged

int main(){
    //declarations
    
    double a,       // a, b, c are the values that are going
    b,              //      to be arranged
    c;              //      the arrangement values are for the
                    //      output
    
    char
    ans;			//eof check

    //main loop
   
    do{
  
        //input
        cout<<"Enter three values to be tested\n";
        cin>>a>>b>>c;
        
        
        //<<<process>>>
        arrange(a,b,c);    
           
        //output
        cout<<""<<a<<" "<<b<<" "<<c<<"\n";
    
        //check for exit
        cout<<"continue? (Y/N) "<<endl;
        do
            ans = toupper(getchar());
 
        while (ans !='Y' && ans != 'N');
        SKIPLINE;
  
    }while (ans == 'Y');
    SKIPLINE;
    //wrap up
 
    cout<<"End of program"<<endl;
    return (0);

}//main()
//----------------------------------------------
void arrange( double& a, double& b, double& c){
    double
    high, mid,low;
    if(a <= b and a <= c)
        high = a;
    else if(b >= c)
        low = c;
        
}
 
your declaration of arrange() doesn't match the function you've defined.

you declare its arguments as doubles, but the actual definition specifies references to doubles.

edit: also, check your logic w/in arrange()
 
in turbo c++ there is a function that tells you the current time in seconds

time_t is the data type
then you would set it equal to some value
like
Code:
time_t t;
t = time(null);
this will give you the time in seconds from like 1970
i need this for a random number generator that we are making in our CSE class
 
Originally posted by mikeyredk
in turbo c++ there is a function that tells you the current time in seconds

time_t is the data type
then you would set it equal to some value
like
Code:
time_t t;
t = time(null);
this will give you the time in seconds from like 1970
i need this for a random number generator that we are making in our CSE class

use time_t time(time_t *tloc)

You'll also have to:
#include <sys/types.h>
#include <time.h>

if you need more details check the docs, esp. the man page for the function.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.