Click here to Skip to main content
15,902,189 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralEnumerated types Pin
satcat1-Mar-04 13:05
satcat1-Mar-04 13:05 
GeneralRe: Enumerated types Pin
Prakash Nadar1-Mar-04 14:51
Prakash Nadar1-Mar-04 14:51 
QuestionVersion writing APIs? Pin
Ravi Bhavnani1-Mar-04 12:55
professionalRavi Bhavnani1-Mar-04 12:55 
AnswerRe: Version writing APIs? Pin
Prakash Nadar1-Mar-04 14:53
Prakash Nadar1-Mar-04 14:53 
GeneralRe: Version writing APIs? Pin
Steve S1-Mar-04 22:28
Steve S1-Mar-04 22:28 
GeneralRe: Version writing APIs? Pin
Ravi Bhavnani2-Mar-04 2:47
professionalRavi Bhavnani2-Mar-04 2:47 
GeneralRe: Version writing APIs? Pin
Steve S2-Mar-04 6:36
Steve S2-Mar-04 6:36 
GeneralSuper Easy C++ program help Pin
Joe Estes1-Mar-04 12:51
Joe Estes1-Mar-04 12:51 
Hi all, I am a total newb when it comes to program, I am currently in the process of writing my 3rd simple program, and I am having a whole bunch of trouble..becuase I am trying to teach myself, and I am lost trying to do this with online tutorials and whatnot

Alright this is my problem i found...I was given a file from a website....(studenttests.dat) It looked like this...
It gives the students name and his 3 tests scores then his average..

Smith Bill 85 75 74
Jones Ann 100 70 80
Walker Thomas 30 90 92

I have to be able to input the file into the program, Be able to calculate a certain students average by giving their name. and the program has to input the first 3 tests scores then average them...For some reason I cannot get the file into the program, I have tried from the A: drive and the C: drive, both to no avail...any help you experts out there could give a rookie like me would be GREAT...this is what I have so far..i know its very simple but like I said...Im a newb, ...this is the coding I have so far...but i am lost

<br />
#include <iostream><br />
#include <string><br />
#include <fstream><br />
#include <iomanip><br />
<br />
using namespace std;<br />
<br />
	int main ()<br />
{<br />
<br />
float lastn1,firstn1, t1,t2,t3, lastn2, firstn2, t21,t22,t23,lastn3, firstn3<br />
,t31,t32,t33, avg1,avg2,avg3;<br />
<br />
ifstream inFile;<br />
inFile.open("C:\\studenttests.dat");<br />
inFile >> lastn1 >> firstn1 >> t1 >> t2 >> t3 >> lastn2 >> firstn2 >> t21 >> <br />
		t22 >> t23 >> lastn3 >> firstn3 >> t31 >> t32 >> t33;<br />
<br />
<br />
if (! inFile)<br />
  {<br />
        cout << "Cant find file joe...." << endl;<br />
        return 0;<br />
}<br />
<br />
avg1 = (t1+t2+t3)/3;<br />
avg2 = (t21+t22+t23)/3;<br />
avg3 = (t31+t32+t33)/3;<br />
<br />
cout << setprecision(2);<br />
cout << " S T U D E N T  G R A D E  R E P O R T"; <br />
cout << endl << endl;<br />
cout << "STUDENT         TEST   TEST   TEST  FINAL";<br />
cout << endl;<br />
cout << " NAME           ONE    TWO   THREE  AVG" << endl;<br />
cout << endl;<br />
cout << setw(3) << avg1;<br />
cout << "lastn1", "firstn1";<br />
cout << avg1, avg2, avg3;<br />
	<br />
	return 0;<br />
<br />
}<br />


Cry | :((
And this is what it SHOULD look like...

S T U D E N T G R A D E R E P O R T
STUDENT TEST TEST TEST FINAL
NAME ONE TWO THREE AVG

BILL SMITH 85 75 74 78.0

ANN JONES 100 70 80 83.3

THOMAS WALKER 30 90 92 70.7

AVERAGE 71.7 78.3 82.0 73.3
GeneralRe: Super Easy C++ program help Pin
Anonymous1-Mar-04 16:03
Anonymous1-Mar-04 16:03 
GeneralRe: Super Easy C++ program help Pin
Prakash Nadar1-Mar-04 18:53
Prakash Nadar1-Mar-04 18:53 
Generalmfc and win32 Pin
vglmco1-Mar-04 11:46
vglmco1-Mar-04 11:46 
GeneralRe: mfc and win32 Pin
l a u r e n1-Mar-04 12:05
l a u r e n1-Mar-04 12:05 
GeneralRe: mfc and win32 Pin
Prakash Nadar1-Mar-04 14:47
Prakash Nadar1-Mar-04 14:47 
GeneralRe: mfc and win32 Pin
vglmco2-Mar-04 4:18
vglmco2-Mar-04 4:18 
GeneralRe: mfc and win32 Pin
Diddy2-Mar-04 11:14
Diddy2-Mar-04 11:14 
GeneralRe: mfc and win32 Pin
Diddy3-Mar-04 12:39
Diddy3-Mar-04 12:39 
GeneralCComPtr and CDHtmlDialog Pin
George L. Jackson1-Mar-04 11:44
George L. Jackson1-Mar-04 11:44 
GeneralRe: CComPtr and CDHtmlDialog Pin
Diddy2-Mar-04 11:19
Diddy2-Mar-04 11:19 
GeneralColor of DialogBox (Looking for macro) Pin
eigen1-Mar-04 11:40
eigen1-Mar-04 11:40 
GeneralRe: Color of DialogBox (Looking for macro) Pin
Ravi Bhavnani1-Mar-04 11:50
professionalRavi Bhavnani1-Mar-04 11:50 
GeneralCreateDispatch and globalalloc Pin
vancouver7771-Mar-04 10:14
vancouver7771-Mar-04 10:14 
GeneralYahoo client.. Pin
RobJones1-Mar-04 10:03
RobJones1-Mar-04 10:03 
General#include &lt;iostream.h&gt; Pin
Anonymous1-Mar-04 8:59
Anonymous1-Mar-04 8:59 
GeneralRe: #include <iostream.h> Pin
User 66581-Mar-04 9:42
User 66581-Mar-04 9:42 
GeneralRe: #include &lt;iostream.h&gt; Pin
John M. Drescher1-Mar-04 9:50
John M. Drescher1-Mar-04 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.