PDA

View Full Version : need some c help




mikeyredk
Oct 23, 2003, 03:28 PM
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
https://cms.psu.edu/AngelUploads/Files/msa173/Picture%201.jpg

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


// 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;

}



zimv20
Oct 23, 2003, 03:42 PM
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()

mikeyredk
Oct 23, 2003, 04:09 PM
silly me
thanks

mikeyredk
Oct 23, 2003, 07:02 PM
just one more question
what is the time equation

Vlade
Oct 23, 2003, 08:15 PM
Originally posted by mikeyredk
just one more question
what is the time equation

Can you be more specific, I don't know what you mean

mikeyredk
Oct 23, 2003, 08:57 PM
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

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

applemacdude
Oct 23, 2003, 09:07 PM
Vlade I hate your 'tar.....

mikeyredk
Oct 24, 2003, 09:43 AM
anyone or do i have to use turbo c :(

MrBubbles
Oct 24, 2003, 10:28 AM
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

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.

Vlade
Oct 25, 2003, 12:46 PM
Originally posted by applemacdude
Vlade I hate your 'tar.....

Thats what it's meant to do :p