I am trying to share information between different pages, and am not having much luck, and don't know what I am doing wrong. I tried reading up about it, but it goes over my head. Any insight would be nice:
//Driver file for the rectangle class (rectype.h)
#include <iostream>
using namespace std;
int menu();
int main()
{
circletype mycircle();
int option = 1;
double r;
while (option != 10)
{
system("cls");
option = menu();
switch (option)
{
case 1:
cout << "Enter the new radius: ";
cin >> r;
mycircle.getradius(r);
break;
/ case 10:
break;
default:
cout << "You have entered an invalid option" << endl;
system("pause");
}//end of switch
} //end of while loop
system("pause");
return 0;
The case and menu isn't really important on there, I'm more worried about what I did wrong from this page to the next page.
//This is circletype.cpp page
//the implementation file for circletype.h
#include "circletype.h"
circletype::circletype()
{
radius = 1;
}
circletype::getradius(double r)
{
if (r <= 0)
{
cout << "There was an invalid parameter for the radius.\n";
cout << "It has been set to 1" << endl;
radius = 1;
}
else
radius = r;
}
Just doing this nets me a lot of errors, and this is the first time I've tried to get stuff from one page to another, and don't know what I'm doing pretty much. Any help would be appreciated. Thank you.