I am beginner in c++ programming however I have tried to run my code but I got error and Idonot understanding can you help me
thanks:)
this is my code
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
#include <conio.h>
#include <iomanip>
#include <map>
#include <algorithm>
#include "Student.h"
using namespace std;
int main()
{
string s, name;
string a, module;
float mark;
int regNo, i;
char filename[15];
ifstream f (filename);
Student stud(name, i);
vector<Student>vs;
map<string, float> marks;
cout<<"please enter a file name to read: "<<endl;
cin>>filename;
f.open(filename);
if(!f)
{
cout << filename << " :this file does not exist" << endl;
}
while(!f.eof())
{
getline(f, s);
istringstream line(s);
line >> i;
line >> name;
vs.push_back(stud);
}
cout<<"please enter a file name to read: "<<endl;
cin>>filename;
f.open(filename);
if(!f)
{
cout << filename << " :this file does not exist" << endl;
}
while(!f.eof())
{
getline(f, a);
istringstream line(a);
line >> i;
line >> module;
line >> mark;
m = marks.insert(pair<string, float>(module, mark))
x=find(vs.begin(), vs.end(), i);
if (x!= vs.end())
{
for (int i=0; i<vs.size(); i++)
{
vs.push_back(m);
}
}
else
{
cout<<"There is no student with the registretion"<<endl;
}
}
void DisplayNamAndAvarage(vector<Student>vs, float mark)
{
total =0;
max=0;
min=0;
float average=0;
for(count=0; count<mark; count++)
{
total=total+mark;
if(mark>max)
max=mark;
if (count==0)
min=mark;
if(mark<min)
min=mark;
avarege = total/count;
}
for (int j=0; j<vs.size(); j++)
{
cout<<setw(6)<<vs[i]<<endl;
}
cout<<setw(6)<<"Average:"<<average<<setw(3)<<"Minmum:"<<min<<setw(3)<<"Maximum:"<<max<<endl;
}
void DisplayNamAndMark(vector<Student>vs, string module)
{
for (int j=0; j<vs.size(); j++)
{
cout<<setw(6)<<vs[i]<<endl;
}
}
char userChoice;
cout<<"1- print name and average"<<endl;
cout<<"2- print name and module"<<endl;
cout<<"Enter option number"<<endl;
cin>>userChoice;
switch(userChoice)
{
case'1':
DisplayNamAndAvarage(vector<Student>vs, float mark);
break;
case'2':
DisplayNamAndMark(vector<Student>vs, string module)
break;
case'0':
break;
}
}
and this is the error message
main.cpp:6:19: conio.h: No such file or directory
main.cpp: In function int main()': main.cpp:54: error:
m' undeclared (first use this function)
main.cpp:54: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:55: error: expected ;' before "x" main.cpp:56: error:
x' undeclared (first use this function)
main.cpp:70: error: a function-definition is not allowed here before '{' token
main.cpp:70: error: expected ,' or
;' before '{' token
main.cpp:94: error: a function-definition is not allowed here before '{' token
main.cpp:94: error: expected ,' or
;' before '{' token
main.cpp:109: error: expected primary-expression before "vs"
main.cpp:109: error: expected primary-expression before "float"
main.cpp:109: error: DisplayNamAndAvarage' undeclared (first use this function) main.cpp:112: error: expected primary-expression before "vs" main.cpp:112: error: expected primary-expression before "module" main.cpp:112: error:
DisplayNamAndMark' undeclared (first use this function)
main.cpp:113: error: expected `;' before "break"
Tool completed with exit code 1