C언어 df
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
/*
class Rectangle
{
private:
int garo, sero, area;
public:
Rectangle(int g, int s){garo=g; sero=s; area=garo*sero;}
int getGaro(){return garo;}
int getSero(){return sero;}
int getArea(){return area;}
};
int main()
{
int garo; int sero; int area;
cout<< "가로: "; cin>>garo;
cout<< "세로: "; cin>>sero;
Rectangle rec(garo, sero);
cout<<"가로 : "<<rec.getGaro()<<",세로 : "<<rec.getSero()<<
", 넓이 :"<<rec.getArea()<<"n"<<endl;
}
int main()
{
Rectangle rec(4, 6);
ofstream rout;
rout.open("c:\rectangle.txt");
rout<<"가로 :" <<rec.getGaro()<<", 세로 : "<<rec.getSero()<<", 넓이 :"
<<rec.getArea()<<endl;
rout.close();
}
*/
class Student
{
private:
string name; int mid, final; float avg;
string std[3]; int std[3];
public:
Student(string n, int m, int f)
{name=n; mid=m; final=f;}
Student(){name=""; mid=0; final=0;}
string getName(){return name;}
int getMid(){return mid;}
int getFinal(){return final;}
float getAvg(){return avg;}
void calcAvg(){avg=(mid + final)/2.0;}
void setStudent(string n, int m, int f){std[3];}
};
/*
int main()
{
string name; int mid; int final; float avg;
cout<<"이름 :"; cin>>name;
cout<<"중간고사 :"; cin>>mid;
cout<<"기말고사 :"; cin>>final;
Student st(name, mid, final);
st.calcAvg();
cout<<"이름 :"<<st.getName()<<", 중간 :"<<st.getMid()<<
", 기말 :"<<st.getFinal()<<", 성적 :"<<st.getAvg()<< endl;
}
*/
int main()
{
string name; int mid; int final; float avg;
Student st();
for (int i=0;i<3;i++)
{
cin>>std[i];
cout<<"이름 : "<<st.getName"n"<<"중간고사 :"<<st.getMid"n"<<"기말고사 :"<<st.getFinal;
}
}