- Oct 9, 1999
- 488
- 0
- 0
okay heres what i'm trying to do. I define a struct and then call a function to write to the struct then call another function to display whats in the struct.
Problem: i dont know how to reference struct in the function prototype; maybe i'm looking at this the wrong way.. anyone wanna straighten me out??
thanks.
CODE:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;
void readvalue(_____);
void showvalue(_____);
struct Quad
{
double a; double b; double c;
};
Quad read;
int main()
{
Quad read;
readvalue(_____);
showvalue(_____);
}
void readvalue(_____)
{
double w, e, r;
cout<<"Enter the coefficients a, b, c: ";
cin>>w >>e >>r;
cout<<w <<e <<r <<endl;
Quad read={w, e, r};
}
void showvalue(_____)
{
cout<<"The values entered are: " <<endl <<read.a <<endl <<read.b <<endl <<read.c <<endl;
}
Problem: i dont know how to reference struct in the function prototype; maybe i'm looking at this the wrong way.. anyone wanna straighten me out??
thanks.
CODE:
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;
void readvalue(_____);
void showvalue(_____);
struct Quad
{
double a; double b; double c;
};
Quad read;
int main()
{
Quad read;
readvalue(_____);
showvalue(_____);
}
void readvalue(_____)
{
double w, e, r;
cout<<"Enter the coefficients a, b, c: ";
cin>>w >>e >>r;
cout<<w <<e <<r <<endl;
Quad read={w, e, r};
}
void showvalue(_____)
{
cout<<"The values entered are: " <<endl <<read.a <<endl <<read.b <<endl <<read.c <<endl;
}
