No matching function for call error
Mar 12, 2017 at 2:33pm UTC
I keep getting this error from my program.
22 26 C:\Users\Earl i&\Desktop\C++ Finals\C++ FINALS.cpp [Error] no matching function for call to 'std::basic_istream<char>::getline(std::string&, int)'
I want to know what's causing it
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
const int studentCount = 2;
ofstream outputFile;
outputFile.open("earlfoz.txt" );
outputFile.clear();
string name[studentCount];
int grade[studentCount];
int index[studentCount];
int i, j;
for (i=0;i<studentCount;i++)
{
cout << "Please enter of student [" <<i<<"]: " ;
cin.getline(name[i],255);
cout << "Please enter grade: " ;
cin.getline(name[i],255);
cout<<endl;
}
for (i=0;i<studentCount;i++)
{
index[i]=i;
}
for (i=0;i<studentCount;i++)
{
for (j=i+1;j<studentCount;j++)
{
int temp;
if (name[index[i]] > name[index[j]])
{
temp = index[i];
index[i] = index[j];
index[j] = temp;
}
}
}
cout << endl;
for (i=0;i<studentCount;i++)
{
cout << name[index[i]] << " "
<< grade[index[i]] << endl;
}
for (i=0;i<studentCount;i++)
{
outputFile<< name[index[i]]<<"\t" ;
outputFile<< grade[index[i]];
outputFile<<endl;
}
outputFile.close();
cout<<"\nSorted List Successfully Printed!!!" <<endl;
cin.ignore();
cin.get();
}
Mar 12, 2017 at 3:30pm UTC
Topic archived. No new replies allowed.