brushing Up the practise of class and its implimentation

#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<string>
#include<Windows.h>
using namespace std;
class Student{
private:
int ID;
string IDch;
string name;
public:
Student(){ int ID = 0; string name; string IDch; }
int getID(){ return ID; }
void setID(int ID){ this->ID = ID; ID = 130201818; cout << ID; cout<<endl; }
string getName(){ return name; }

void setName(string name){ this->name = name; name = ""; cout << "     " << name<<endl; }
string getIdChar(){ return IDch; }// as integers are mixed with characters so the bc part has beeen taken case of with
//this function
void setIDch(string IDch){ this->IDch = IDch; IDch = "BC"; cout << "   Student ID :::  " << IDch; }
void display(){ID;  IDch; name; getIdChar();
setIDch(IDch); getID();
setID(ID);
getName();
setName(name);  }
};
class Instructor{
private: double average; int max;   int i;  double height[30];//PRIVATE SECTION
public: Instructor(){ height[30] = 0; max = 0; average = 0; }//PUBLIC SECTION
double getHeight(){ return height[30]; }///////////////////////////////
int getMax(){return max;}
void setMax(int max){this->max=max;}
void setHeight(double height[30]){this->height[30] = height[30];///////////////////
cout << "   Height  Averaging  Program Software VU.A.1/I\n";
cout << "   Please Enter  No of instructor  that you want to include eg 1 ...100  :";

int num;
cin >> max;
for (int i = 0; i < getMax(); i++){cout << "   Enter the height of the instructor [" << i << "]  ";
cin >> height[i];
if(height[i]>7||height[i]<4){cout<<"\n \n   [ERROR]Invalid height. Run the program again\n"; break;}}}
double getAve(){return average;}
void setAve(double average){this->average=average;
Instructor mo;
mo.max;
mo.getHeight();
double*ptr;

ptr=&average;
for(int i=0;i<getMax();i++) {
cout<<endl;
*ptr=*ptr+  height[i]/max;
}
cout<<"   \n   The Average Height of the Faculty is  "<<average<<"Feet & Feet/10";
return;
}
void Bigdisplay(){ getHeight(); setHeight(height); getAve();setAve(average); }
~Instructor(){}
};
int main(){
Student so;
cout << endl;
cout << endl;
so.display();
cout << endl;
Instructor i;
i.Bigdisplay();
cout<<endl;
cout<<"   Open Licence  Copy Right 2014 Rights Reserved ";
cout<<endl;
cout<<endl;
cout<<endl;
system("pause");
return 0;
}

Recommended Answers

All 3 Replies

What is your question?

Since you're brushing up, remember that in order for others to understand your code easier, put the declaration for each variable on a separate line and indent properly.

Sir
Thanks for giving a valueable advise.
I will try my best to make it my habbit, As programs if not readable are not maintainable
I realy apreciate for your generocity
Regards
Ahmed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.