Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
I just want get this portion of the code to compile.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Charles Wilson, post: 5021095"] I believe that my problem is in how I am doing my C++ strings. But I am not sure. Can someone point me in the right direction. Thank you #include <iomanip> #include <iostream> #include <fstream> #include <cstring> using namespace std; int main() { struct{int chronum;string pname;int next;}//makes structure box with C ++ style string plist[50],temp;//give the number of colmns int n=0,end,maxindex,i; ifstream fin; ofstream fout; fin.open("pres.dat"); fout.open("hw7.dat"); fin>>plist[n].pname;//inputs president name into list while(!fin.eof()) { plist[n].chronum=n+1;//assigns chronum to presidents as inputed. n++;//tracks current president fin>>plist[n].pname; } for(end=n-1;end>0;end--)//it seems to input all on the first past and than removes one of end each time. { maxindex=0; for(i=1;i<=end;i++) if(plist[i].pname>plist[maxindex].pname) maxindex=i; temp=plist[maxindex]; plist[maxindex]=plist[end]; plist[end]=temp; } //cout.setf(ios::fixed); //cout.setf(ios::showpoint); //cout.precision(2); //cout<<plist[i].chronum<<plist[i].pname<<endl; return 0; }[/i][/i][/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
I just want get this portion of the code to compile.
Top