Under Assignments on this website, you will see program 5
Computer Science 1044 Web site
I would much appreciate it if i can get some help with this program.
Help with a Structure Array, Character Strings, Searching Program
Started by luke21, Nov 14 2010 09:06 PM
7 replies to this topic
#1
Posted 14 November 2010 - 09:06 PM
|
|
|
#2
Posted 14 November 2010 - 09:19 PM
Hi,
I'd like you to start the assignment yourself, and ask specific questions for the problems you face during the homework; we ll definately help you :-)
Thanks,
Munir
I'd like you to start the assignment yourself, and ask specific questions for the problems you face during the homework; we ll definately help you :-)
Thanks,
Munir
#3
Posted 15 November 2010 - 01:45 PM
I have a problem calculating the first part of the output ( QCA, AltQCA)
This is what i have until now:
This is what i have until now:
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main() {
// Constant declarations:
//
const string DASHLINE = "_______________________________________________________________________";
const char NEWLINE = '\n';
const char TAB = " ";
const char TAB1 = " ";
const char TAB3 = " ";
const string DATAFILE1 = "student.dat"; // input data file
const string DATAFILE2 = "courses.dat"
const string RESULTSFILE = "qca.dat"; // output data file
// Variable declarations:
//
int Zip;
Rank;
Course_Number;
Hours;
Year;
double QCredits;
QCA;
AltQCA;
QCredit;
Cred;
QCA_Total;
string ID;
Name;
Address;
State;
Major;
Minor;
Department;
Term;
Grade;
Title;
ifstream iFile; // input file stream
ofstream oFile; // output file stream
iFile.open(DATAFILE1.c_str()); // open input file
iFile.open(DATAFILE2.c_str());
oFile.open(RESULTSFILE.c_str()); // open output file
oFile << fixed << showpoint;
//task that prints the header information to the output file
oFile << "Yousef Halwani" << endl;
oFile << "QCA calculation" <<endl;
oFile <<endl;
oFile << "_______________________________________________________________________"
oFile << endl;
//alignment and naming of output
oFile << "ID Number" << TAB;
<< "Name" << TAB1 ;
<< "Major" << TAB;
<< "Minor" << TAB;
<< "Rank" << endl;
oFile.ignore(255, NEWLINE);
oFile << QCA << TAB3;
<< AltQCA << TAB;
<< QCredits << TAB;
<< Hours Att<< endl;
//reading data/values from the input
iFile >> ID >> Name >> Address_St >> Zip >> Major >> Minor >> Rank >> QCA >> AltQCA >> QCredit >> Hours >> Index >> Department >> Course >> Term
>> Year >> Cred >> Grade >> Title;
//start of while loop
//while (iFile) {
iFile.ignore(255, NEWLINE); //start of new line
QCA_total = (QCA/4.0) * 40
return 0;
//end of main
}
Edited by Alexander, 16 November 2010 - 04:14 AM.
Added [code] tags.
#4
Posted 15 November 2010 - 09:48 PM
Hi,
I see a lot of compilation error in your code. For example, the variable declaration doesn't seem to be correct.
See:
It should have really been
There are another mistake declaring const string pointers
See your code:
It must have been:
Please correct these errors, and let me know else what problem are there?
Munir
I see a lot of compilation error in your code. For example, the variable declaration doesn't seem to be correct.
See:
int Zip; Rank; Course_Number; Hours; Year;
It should have really been
int Zip[COLOR="Red"],[/COLOR] Rank[COLOR="Red"],[/COLOR] Course_Number[COLOR="Red"],[/COLOR] Hours[COLOR="Red"],[/COLOR] Year;
There are another mistake declaring const string pointers
See your code:
const string DASHLINE = "_________________________________________________ ______________________"; const char NEWLINE = '\n'; const char TAB = " "; const char TAB1 = " "; const char TAB3 = " ";
It must have been:
const [COLOR="Red"]*[/COLOR]char NEWLINE = '\n'; const [COLOR="Red"]*[/COLOR]char TAB = " "; const [COLOR="Red"]*[/COLOR]char TAB1 = " "; const [COLOR="Red"]*[/COLOR]char TAB3 = " ";
Please correct these errors, and let me know else what problem are there?
Munir
#5
Posted 16 November 2010 - 02:06 PM
Thanks Munir! I have problems finding QCA AltQCA QCredits Hours Att.
This is part 1 of the output.
This is part 1 of the output.
#6
Posted 16 November 2010 - 02:34 PM
Hi,
Since your code isn't compilable at this stage, so I can't imagine what's wrong by just reading through the source code.
Could you please specify what's the output you're expecting and what you're having when you run the program?
Munir
Since your code isn't compilable at this stage, so I can't imagine what's wrong by just reading through the source code.
Could you please specify what's the output you're expecting and what you're having when you run the program?
Munir
#7
Posted 16 November 2010 - 08:19 PM
Im just having problems connected the data i have in the input to get what is asked for in the output. In the first part of the output, they ask for what i previously mentioned (QCA AltQCA QCredits Hours Att.). Then the output asks for creating a gpa bar graph for each semester. You will probably understand what im saying if you look at my first post and click the link.
#8
Posted 17 November 2010 - 02:24 PM
check your inbox!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









