2005/07/22 ¶
3 2 그.... ..ㅡㅜ
2 3 1 까 거 ...
까???@,.@
2 3 1 까 거 ...
까???@,.@
~cpp #include <algorithm> #include <iomanip> #include <ios> #include <iostream> #include <string> #include <vector> using std::cin; using std::sort; using std::cout; using std::streamsize; using std::endl; using std::string; using std::setprecision; using std::vector; int main() { cout << "Please enter your first name: "; string name; cin >> name; cout << "Hello, " << name << "!" << endl; cout << "Please enter yourmidterm and final exam grades: "; double midterm, final; cin >> midterm >> final; cout << "Enter all your homework grades, " "followed by endoffile:"; vector<double> homework; double x; while (cin >> x) homework.push_back(x); typedef vector<double>::size_type vec_sz; // 기 1 vec_sz size = homework.size(); // 기 2 if(size == 0) { cout << endl << "You must enter your grades. " "Please try again." << endl; return 1; } sort(homework.begin(),homework.end()); vec_sz mid = size/2; // 기 3 double median; median = size %2 == 0 ? (homework[mid] + homework[mid-1])/2 :homework[mid]; streamsize prec = cout.precision(); cout << "Your final grade is " << setprecision(3) << 0.2* midterm + 0.4*final + 0.4*median << setprecision(prec) << endl; return 0; }
Answer.
- VS6 겠 namespace 기고, 간 namespace .
그 고 ZP gcc . 계 .
그 고 VS6 고
using using namespace std; 꾸 .
.net 겠. - eternalbleu
1 고 Dev-CPP gcc 기 군. 걸 . 고 - eternalbleu
- ... g++ ~ -
- 고 g++ gcc c++ .
g++ test.cpp -o test
gcc -lstdc++ test.cpp -o test
결과 . - eternalbleu