I just submitted an assignment where i was to apply multiple functions to a c++11 array. My code would run fine as long as i only applied one function to the array. Any help on understanding what i am leaving out would be appreciated
usingnamespace std;
int main(int argc, char** argv)
{//top of main
array<string,10>bowl;
ifstream infile("c:\\c++data\\bowlers1.txt");
if(!infile)//verify file is found
{//top of verify if
cout<<"cannot open file.";
cout<<"This program will terminate.";
return 1;
}//bottom of verify if
for(int r=1;r<=10;r++)
{
getline(infile,bowl[r]);
}
infile.close();
for(string s:bowl)
cout<<s<<endl;
cout<<"The array size is "<<bowl.size()<<endl;
sort(bowl.begin(),bowl.end());
cout<<"Sorted A to Z:\n";
for(string s:bowl)
cout<<s<<endl;
sort(bowl.rbegin(),bowl.rend());
cout<<"Sorted Z to A:\n";
for(string s:bowl)
cout<<s<<endl;
cout<<bowl.at(3)<<endl;
bowl.fill("*");
for(string s:bowl)
cout<<s<<endl;
return 0;
}