I keep getting these errors:
||=== Build: Debug in Oefen (compiler: GNU GCC Compiler) ===|
|In function 'int main()':|
|15|error: expected primary-expression before '<' token|
15|error: 'vector' was not declared in this scope|
15|error: expected primary-expression before 'double'|
|15|error: expected ';' before 'double'|
|17|error: 'homework' was not declared in this scope|
21|error: 'homework' was not declared in this scope|
26|error: 'homework' was not declared in this scope|
27|error: conflicting declaration 'int mid'|
8|error: 'mid' has a previous declaration as 'double mid'|
31|error: 'median' was not declared in this scope|
||=== Build failed: 10 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
cout << "Please enter Midterm and final exam grade: ";
double mid, final;
cin >> mid >> final;
cout << mid << final;
cout << "Enter All Homework grades"
<< "Followed by end-of-file";
double x;
<vector>double homework;
while(homework.size() != 3){
cin >> x;
homework.pushback(x);
}
if (homework.size() == 0){
cout << "Enter at least one homework grade"
<< "Please Ty Again" << endl;
return 1;
}
sort (homework.begin(), homework.end());
int mid = homework.size() / 2;
if (homework.size % 2 == 0){
}else{
median = homework[mid];
}
return 0;
}
|