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










