structs with pointers
structs with pointers
#include <fstream>
using namespace std;
struct STUDENT
{
string NAME;
int STUDENTNUMBER;
double GPA;
};
int main ()
{
STUDENT freshman;
cout << "Enter the following student information : " << endl;
studentdata(&freshman);
// now that you have stored frehsman in the computer ,the computer lost it and
now you have to find
// it by finding its address which uses the &
cout <<"Here is the information you entered :" << endl;
cout << "NAME :" << freshman.NAME << endl;
cout << "STUDENT NUMBER :" << freshman.STUDENTNUMBER << endl;
cout << "STUDENT GPA :" << freshman.GPA << endl;
return 0;
#include <iostream>
#include <string>
using namespace std;
struct Two {int two;};
class Four
{
int one, two;
public:
Four(){};
~Four(){};
four(int w){};
Four(string w){};
getOne(int one){
return one;
};
};
class three{
private:
int one;
int two;
Four four;
public:
three(){};
int getOne(four v){
return v.one ;
};
void setTwo(Two tw){
Four.two = 2;
};
three(){
delete four;
};
};
int main () {
Four f;
three t;
t->getOne(f);
return 0;
}