Задачка на С++ ми е необходима до седмица, моля ви помогнете / аз честно да си призная не мога да я направя и ако е нужно ще платя /.
Ето я и нея:
За група студенти са зададени име, ЕГН, фак. номер, оценките по 10 дисциплини.
Да се създаде програма, използуваща подпрограми за:
- създаване на файл с информация за групата студенти;
-изчисляване на средния успех на всеки судент;
-изчисляване на средния успех по първата дисциплина на групата студенти.
Благодаря ви предварително!!!
Дадоха ми програмката готова но излизат 6 грешки, ако някой може да помогне да се отстранят
ще бъде върха!!!!
Благодаря ви !!!
Ето я:
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
struct Student{
string Name;
string Number;
string EGN;
int Array[15];
};
vector <Student> V;
int N;
void Print(int N){
ofstream fout("File.txt");
for(int i=0;i<N;i++){
fout<<"Student "<<i+1<<endl;
fout<<"Ime: "<<V.Name<<endl;
fout<<"EGN: "<<V.EGN<<endl;
fout<<"Nomer: "<<V.Number<<endl;
for(int j=0;j<10;j++){fout<<"Ocenka po disciplina "<<j+1<<": "<<V.Array[j]<<endl;}
fout<<endl<<endl;
}
}
void Sredno(int N){
for(int i=0;i<N;i++){
int S=0;
for(int j=0;j<10;j++){S+=V.Array[j];}
cout<<"Sreden uspeh na u4enik "<<i+1<<": "<<(double)S/10<<endl;
}
cout<<endl;
}
void SrednoD(int N,int k){
int S=0;
k--;
for(int i=0;i<N;i++){S+=V.Array[k];}
cout<<"Sreden uspeh na u4enicite po disciplina "<<k+1<<" e "<<(double)S/N<<endl<<endl;
}
int main(){
cout<<"Broi u4enici v grupata:";
cin>>N;
for(int i=0;i<N;i++){
Student S;
cout<<"Student "<<i+1<<endl;
cout<<"Ime:";cin>>S.Name;
cout<<"EGN:";cin>>S.EGN;
cout<<"Nomer:";cin>>S.Number;
for(int j=0;j<10;j++){cout<<"Ocenka po disciplina "<<j+1<<":";cin>>S.Array[j];}
cout<<"\n\n";
V.push_back(S);
}
//Процедура за извеждане във файл
Print(N);
//Среден успех на учениците
Sredno(N);
//Среден успех на която и да е дисциплина (1-ницата може да я замениш с която искаш)
SrednoD(N,1);
system("pause");
}
А това са грешките:
--------------------Configuration: Base - Win32 Debug--------------------
Compiling...
Base.cpp
c:\documents and settings\don danko\desktop\base.cpp(24) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
no acceptable conversion)
c:\documents and settings\don danko\desktop\base.cpp(25) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
no acceptable conversion)
c:\documents and settings\don danko\desktop\base.cpp(26) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
no acceptable conversion)
c:\documents and settings\don danko\desktop\base.cpp(55) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
no acceptable conversion)
c:\documents and settings\don danko\desktop\base.cpp(56) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
no acceptable conversion)
c:\documents and settings\don danko\desktop\base.cpp(57) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
no acceptable conversion)
c:\documents and settings\don danko\desktop\base.cpp(71) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.
Base.exe - 6 error(s), 1 warning(s)