#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
#include <iostream> #include <fstream> #include <cstdlib> #include<string> using namespace std; class student { public: string name; int math; int java; int OS; int XO; student(){}; student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w; XO = (math + java + OS) / 3.0; }
#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; class student { public: string name; int math; int java; int OS; int OX;
student(){}; student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w; OX = (math + java + OS) / 3.0; }
}; ostream& operator<<(ostream&ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << ","<<X.OX<<endl; return ff; }; void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++;
} a[i] = tmp.substr(start, tmp.length() - start); }; istream& operator >>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); X = student(name, math, java, OS); return ff; }; int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X;
class student{ public: string name; int math; int java; int OS; int avg; student(){}; student(string x, int y, int z, int w ,int t){ name = x; math = y; java = z; OS = w; avg = t; } };
ostream& operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS <<","<<X.avg<<endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream& operator >>(istream& ff, student& X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int avg = (math + java + OS) / 3.0; X = student(name, math, java, OS,avg); return ff; }
class student{ public: string name; int math; int java; int OS; int avg; student(){}; student(string x, int y, int z, int w ,int t){ name = x; math = y; java = z; OS = w; avg = t; } };
ostream& operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS <<","<<X.avg<<endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream& operator >>(istream& ff, student& X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int avg = (math + java + OS) / 3.0; X = student(name, math, java, OS,avg); return ff; }
class student{ public: string name; int math; int java; int OS; int avg; student(){}; student(string x, int y, int z, int w ,int t){ name = x; math = y; java = z; OS = w; avg = t; } };
ostream& operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS <<","<<X.avg<<endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream& operator >>(istream& ff, student& X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int avg = (math + java + OS) / 3.0; X = student(name, math, java, OS,avg); return ff; }
#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0; }
#include #include #include #include using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
#include #include #include #include using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
#include #include #include #include using namespace std; class student { public: string name; int math; int java; int OS; student() {}; student(string x, int y, int z, int w){ name = x; math = y; java = z; OS = w; AVGS(); } double AVGS(){ return (math + java + OS) / 3.0; } };
ostream&operator<<(ostream& ff, student X){ ff << X.name << ","; ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl; return ff; } void stringSplitter(string tmp, string a[4]){ int n; int i = 0, start = 0; while ((n = tmp.find(",", start)) != -1){ a[i] = tmp.substr(start, n - start); start = n + 1; i++; } a[i] = tmp.substr(start, tmp.length() - start); } istream&operator>>(istream& ff, student&X){ string tmp; getline(ff, tmp); string a[4]; stringSplitter(tmp, a); string name = a[0]; int math = stoi(a[1]); int java = stoi(a[2]); int OS = stoi(a[3]); int AVG = (math + java + OS) / 3.0; X = student(name, math, java, OS); return ff; } int main(){ ifstream f_in; ofstream f_out; f_out.open("out.csv", ios::out); f_in.open("ez.csv", ios::in); string tmp; string name; int math, java, OS; do{ student X; f_in >> X; f_out << X; cout << X; } while (!f_in.eof()); f_in.close(); system("Pause"); return 0;
16 則留言:
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
double av;
student(){};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w; av = (y + z + w) / 3.0;
}
};
ostream& operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.av << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream& operator >>(istream& ff, student& X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student
{
public:
string name;
int math;
int java;
int OS;
float san;
student(){};
student(string x, int y, int z, int w,float c){
name = x; math = y; java = z; OS = w;
san = c;
}
};
ostream&operator<<(ostream&ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS <<"," <<X.san<<endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1)
{
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream& operator>>(istream&ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
float san = (math + java + OS) / 3.0;
X = student(name, math, java, OS,san);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
float san;
do
{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include<string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
int XO;
student(){};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
XO = (math + java + OS) / 3.0;
}
};
ostream& operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.XO << endl;
return ff;
};
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
};
istream& operator >> (istream& ff, student& X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
X = student(name, math, java, OS);
return ff;
};
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
int OX;
student(){};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
OX = (math + java + OS) / 3.0;
}
};
ostream& operator<<(ostream&ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << ","<<X.OX<<endl;
return ff;
};
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
};
istream& operator >>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
X = student(name, math, java, OS);
return ff;
};
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student{
public:
string name;
int math;
int java;
int OS;
int avg;
student(){};
student(string x, int y, int z, int w ,int t){
name = x; math = y; java = z; OS = w; avg = t;
}
};
ostream& operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS <<","<<X.avg<<endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream& operator >>(istream& ff, student& X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int avg = (math + java + OS) / 3.0;
X = student(name, math, java, OS,avg);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
do{
student X;
f_in >> X;
f_out << X;
cout <<X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student{
public:
string name;
int math;
int java;
int OS;
int avg;
student(){};
student(string x, int y, int z, int w ,int t){
name = x; math = y; java = z; OS = w; avg = t;
}
};
ostream& operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS <<","<<X.avg<<endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream& operator >>(istream& ff, student& X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int avg = (math + java + OS) / 3.0;
X = student(name, math, java, OS,avg);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
do{
student X;
f_in >> X;
f_out << X;
cout <<X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student{
public:
string name;
int math;
int java;
int OS;
int avg;
student(){};
student(string x, int y, int z, int w ,int t){
name = x; math = y; java = z; OS = w; avg = t;
}
};
ostream& operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS <<","<<X.avg<<endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream& operator >>(istream& ff, student& X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int avg = (math + java + OS) / 3.0;
X = student(name, math, java, OS,avg);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
do{
student X;
f_in >> X;
f_out << X;
cout <<X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
#include
#include
#include
#include
using namespace std;
class student {
public:
string name;
int math;
int java;
int OS;
student() {};
student(string x, int y, int z, int w){
name = x; math = y; java = z; OS = w;
AVGS();
}
double AVGS(){
return (math + java + OS) / 3.0;
}
};
ostream&operator<<(ostream& ff, student X){
ff << X.name << ",";
ff << X.math << "," << X.java << "," << X.OS << "," << X.AVGS() << endl;
return ff;
}
void stringSplitter(string tmp, string a[4]){
int n;
int i = 0, start = 0;
while ((n = tmp.find(",", start)) != -1){
a[i] = tmp.substr(start, n - start);
start = n + 1;
i++;
}
a[i] = tmp.substr(start, tmp.length() - start);
}
istream&operator>>(istream& ff, student&X){
string tmp;
getline(ff, tmp);
string a[4];
stringSplitter(tmp, a);
string name = a[0];
int math = stoi(a[1]);
int java = stoi(a[2]);
int OS = stoi(a[3]);
int AVG = (math + java + OS) / 3.0;
X = student(name, math, java, OS);
return ff;
}
int main(){
ifstream f_in;
ofstream f_out;
f_out.open("out.csv", ios::out);
f_in.open("ez.csv", ios::in);
string tmp;
string name;
int math, java, OS;
do{
student X;
f_in >> X;
f_out << X;
cout << X;
} while (!f_in.eof());
f_in.close();
system("Pause");
return 0;
}
張貼留言