Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Help With First C++ program?

Reply
Thread Tools

Help With First C++ program?

 
 
Ranger's Sweetheart Ranger's Sweetheart is offline
Junior Member
Join Date: Sep 2011
Posts: 1
 
      09-15-2011
Hi, I'm very new to C++ and computer programming in general. I'm sorry if this is an annoying question or a terrible program. I am fairly sure the logic of my program is right and I just have a bunch of syntax errors. Can anyone help me fix them? I've fixed all I can figure out how to fix, and my program looks like this:



#include <conio.h>
#include <iomanip>
#include <iostream>
#include <fstream>
using namespace std;
void heading();
void printTotals();
void getRecord(char snum, char fname, char lname, char course, int credits);
void write_to_file(char snum,char fullName,char course,int credits);
int totStud;
int totCredit;
int stCredit;
char hnum;
ifstream infile;
ofstream outfile;
int main()
{infile.open("Program2.txt");
outfile.open("Program2.rpt");
heading();
while (!infile.eof())

getRecord();
hnum=snum;
{if (snum==hnum)
strcpy(fullName, fname);
strcat(fullName, " ");
strcat(fullName,lname);
write_to_file(snum,fullName,course,credits);
totCredit += credits;
stCredit += 1;

else
outfile<<set(34)<<" "<<set(14)<<"Student Total"<<set(10)<<" "<<set(5)<< stCredit
totStud +=1;
stCredit=0;
hnum=snum; endl
outfile<< "Total Students = "<< totStud endl;
outfile<< "Total Credits = "<< totCredit; endl;
outfile.close()
}


}
void heading()
{
outfile << "NUMBER STUDENT NAME COURSE CREDITS TOTAL CR" << endl;
}
void printTotals()
{
}
void getRecord(char snum, char fname, char lname, char course, int credits)
{
infile >> snum >> fname >> lname >> course >> credits;

}
void write_to_file(char snum, char fullName, char course, int credits,int stCredit)
{
outfile<< setw(10) << snum << setw(5) << " "
<< setw(15) << fullName << setw(5) << " "
<< setw(9) << course << setw(5) << " "
<< setw(6) << credits << setw(5) << " ";
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
70-290 first or 70-291 first? MCSE 2 07-11-2006 03:30 AM
I'm lazy: how do I make the first databound record not display/chop off the first element from SqlDataSource ASP .Net 7 06-28-2006 10:24 AM
20D's first field trip. First Snake of Spring Celtic Boar Digital Photography 3 04-10-2005 09:40 PM
help with my first project on first job, how to read a strange file, thanks a lot!!!!!!! matt Java 9 10-27-2004 03:32 AM
FS: First Clamshell Laptop - First Laptop in Space - GRiD 1101 Compass Computer Dave Computer Information 0 09-22-2004 10:59 PM



Advertisments