Ask Experts Questions for FREE Help !
Ask
    chemengr12's Avatar
    chemengr12 Posts: 1, Reputation: 1
    New Member
     
    #1

    Oct 26, 2009, 09:49 AM
    Alignment Difficulties of my c++ program
    The program is already right but it has some alignment issues and I cannot figure out how to fix it and I tried everything! If anyone could, can I please get some help before 12 am Tuesday, it will be greatly appreciated? This is the program:

    //IT 210 Business Applications with C++

    //Programmer: Aristio Alston

    //Date: 10/20/09

    //Program Assignment 2: Student Grades II

    #include<iostream>

    #include<iomanip>

    #include<conio.h>

    #include<fstream>

    using namespace std;

    int main(){

    system("color f0");





    cout<<"0123456789012345678901234567890123456789012 34567890123456789"<<endl;

    cout<<"******************************************* *****************"<<endl;

    cout<<"* IT 210 Business Applications with C++ *"<<endl;

    cout<<"* Programmer: Aristio Alston *"<<endl;

    cout<<"* Date: October 20, 09 *"<<endl;

    cout<<"* *"<<endl;

    cout<<"* Program Assignment 2: Student Grades II *"<<endl;

    cout<<"* *"<<endl;

    cout<<"* This program reads student information from *"<<endl;

    cout<<"* an input text file and outputs the results *"<<endl;

    cout<<"* to the monitor as well as to a text file *"<<endl;

    cout<<"* *"<<endl;

    cout<<"******************************************* *****************"<<endl;

    cout<<endl;



    cout<<"Welcome to the IT210 Grade Calculator!"<<endl<<endl;

    cout<<"Examine the output file now before you proceed!"<<endl<<endl;





    cout<<"Press any key to read input and calculate the grades of all students\n";

    getch();





    ifstream fin;

    ofstream fout;



    int prog1, prog2, prog3, prog4, prog5;

    int test1, test2;

    int totalPoints;

    string fName, lName;

    float progAvg, testAvg, courseAvg;







    fin.open("input.txt");

    if(!fin){

    cout<<"Input failure\n";

    system("pause");

    return 1;

    } //end of enclosure

    fout.open("output.txt");

    if(!fout){

    cout<<"Output failure\n";

    system("pause");

    return 1;

    } // end of error check


    cout<<"\n12345678901234567890123456789012345678901 23456789012345678901234567890"<<endl;

    fout<<setw(10)<<setfill('=')<<endl;

    cout<<setw(15)<<left<<"Student Name"<<setw(15)<<"Total"<<setw(15)<<"Program"<<set w(15)<<"Test"<<setw(15)<<"Course"<<setw(15)<<"Grad e"<<endl;

    cout<<setw(15)<<left<<" "<<setw(15)<<"Points"<<setw(15)<<"Average"<<setw(1 5)<<"Average"<<setw(15)<<"Average"<<setw(15)<<" "<<endl;

    cout<<"--------------------------------------------------\n\n";

    fout<<"\n12345678901234567890123456789012345678901 23456789012345678901234567890"<<endl;

    fout<<setw(10)<<setfill('=')<<endl;

    fout<<setw(15)<<left<<"Student Name"<<setw(15)<<"Total"<<setw(15)<<"Program"<<set w(15)<<"Test"<<setw(15)<<"Course"<<setw(15)<<"Grad e"<<endl;

    fout<<setw(15)<<left<<" "<<setw(15)<<"Points"<<setw(15)<<"Average"<<setw(1 5)<<"Average"<<setw(15)<<"Average"<<setw(15)<<" "<<endl;

    fout<<"--------------------------------------------------\n\n";


    while(fin){

    fin>>fName>>lName>>prog1>>prog2>>prog3>>prog4>>pro g5>>test1>>test2;

    totalPoints = (prog1 + prog2 + prog3 + prog4 + prog5) + (test1 + test2);

    progAvg = (prog1 + prog2 + prog3 + prog4 + prog5)/5.0;

    testAvg = (test1 + test2)/2.0;

    courseAvg = (progAvg + testAvg)/2.0;

    cout<<fName +" "+ lName<<setw(10)<<left <<totalPoints<<setw(10)<<progAvg<<setw(10)<<testAv g<<setw(10)<<courseAvg<<endl;

    fout<<fName+" "+lName<<setw(10)<<left<<totalPoints<<setw(10)<<pr ogAvg<<setw(10)<<testAvg<<setw(10)<<courseAvg<<end l;



    if (fin.peek() == '\n')fin.ignore();

    }

    fin.close();

    fout.close();



    system("pause");

    return 0;

    }
    yumbrad's Avatar
    yumbrad Posts: 4, Reputation: 1
    New Member
     
    #2

    Feb 12, 2010, 08:39 PM

    What do you mean "alignment"... cout text alignment? Memory alignment of some sort? Describe the problem in more detail please.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Alignment and refill problems [ 6 Answers ]

The Elger touch up kit consisted of the toilet valve, plastic arm, chain, plastic control device Which is seated under the tank bolt on inside of toilet ,(Looks like a U), the tank bolts, and rubber ball which seats in opening after the flush to keep the water inside while the tank refills. I...

Margin alignment [ 4 Answers ]

I can't seem to get my margin back after I draged it way to the top, I tried everything I can to get it back, reinstalling, reparing but it doesn't seem to help. Does someone know of a rest for Microsoft word 2007? http://img461.imageshack.us/img461/1278/untitledct5.jpg


View more questions Search