Click here to Skip to main content
15,898,222 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Editbox identification problem Pin
gajendrakashyap29-Oct-06 19:20
gajendrakashyap29-Oct-06 19:20 
AnswerRe: Editbox identification problem Pin
stanlymt29-Oct-06 19:36
stanlymt29-Oct-06 19:36 
GeneralRe: Editbox identification problem Pin
ThatsAlok29-Oct-06 19:50
ThatsAlok29-Oct-06 19:50 
GeneralRe: Editbox identification problem Pin
stanlymt29-Oct-06 20:00
stanlymt29-Oct-06 20:00 
GeneralRe: Editbox identification problem Pin
ThatsAlok30-Oct-06 22:31
ThatsAlok30-Oct-06 22:31 
GeneralRe: Editbox identification problem Pin
ThatsAlok29-Oct-06 19:47
ThatsAlok29-Oct-06 19:47 
GeneralRe: Editbox identification problem Pin
gajendrakashyap29-Oct-06 20:00
gajendrakashyap29-Oct-06 20:00 
QuestionInputing data from .txt to array. Pin
Ramper29-Oct-06 16:09
Ramper29-Oct-06 16:09 
I have a program that is able to take the numbers out of the .txt if it is just a list of numbers. Problem is, I have a file with Names before the grades. I believe i need to set up another array inside the first one to fill with names. The .txt file will look like:

Name
grade
grade
grade
grade
grade
grade
grade
grade
grade
grade
Name
...

Have 15 Names with 10 grades under each. I guess what i'm trying to do is take the strings out of the file. Is there a way to take the strings(there is a string every 11 lines)

Here is what i have now:

#include
#include
#include
#include
#include
#include

using namespace std;

const int TESTS = 10;
const int STUDENTS = 15;

void displayGrades( int [][TESTS] );
void getGrades( int [][TESTS]);

int main()
{
int data[STUDENTS][TESTS] = {0};

getGrades( data );

cout <<fixed <<setprecision(1);

displaygrades(="" data);

#ifdef="" win32
system("pause");
#endif
return="" 0;
}

void="" getgrades(int="" data[]="" [tests])
{
ifstream="" inputfile;
inputfile.open("gradespring07.txt");
if="" (!inputfile)
{

cout="" <<="" "error="" opening="" file!"="" endl;
exit(="" 1="" );
}





for="" (int="" student="0;" student<="" students="" ;="" student++)
{
for="" test="0;" test
{


inputfile="">> data[student][test];





}

}
}
void displayGrades( int data[][TESTS] )
{

double testTotal = 0.0;
double classTotal = 0.0;
double squared = 0.0;
double var = 0.0;
double sdev = 0.0;
int mxm = data[0][0];
int min = data[0][0];

cout << "\nGrade summary" << endl;
cout << "--------------" << endl;
cout << left << setw(7) << "Student"
<< right << setw(5) << right << "Ex1"
<< setw(7) << "Ex2"
<<setw(6) <<="" "ex3"
<<setw(6)="" "qz1"
<<setw(5)="" "qz2"
<<setw(6)="" "qz3"
<<setw(6)="" "qz4"
<<setw(6)="" "qz5"
<<setw(6)="" "pr1"
<<setw(6)="" "pr2"
<<setw(8)="" <<"averg"="" <<endl;

for="" (="" int="" student="0;" <="" students;="" ++)
{
cout="" left="" <<setw(7)="" +="" 1;

for="" test="0;" tests;="" test++)
{
int="" grade="data[student][test];
cout" right="" <<setw(5)="" <<"="" ";


classtotal="" average="(((data[student][0]+data[student][1]+data[student][2])/3)*0.4)+(((data[student][8]+data[student][9])/2)*0.3)+(((data[student][3]+data[student][4]+data[student][5]+data[student][6]+data[student][7])/5)*0.3);
cout" setw(7)="" endl;


}

cout="" "\n"="" "test="" avg";

for="" (int="" test++)
{
for="" student++)
{
testtotal="" setw(6)="" testtotal="" students;

testtotal="0.0;
}

cout" endl;

cout="" "stan="" dev";

for="" student++)
{
squared="" 2.0);
var="(squared" -="" ((testtotal="" *="" testtotal)="" 15)="" )="" 15;
sdev="sqrt(var);
}

cout" sdev;

sdev="0.0;

}

cout" "max";

for="" student++)
{

if="" (data[student][test]=""> mxm)
{

mxm = data[student][test];
}
}

cout << right <
AnswerRe: Inputing data from .txt to array. Pin
benjymous29-Oct-06 21:47
benjymous29-Oct-06 21:47 
GeneralRe: Inputing data from .txt to array. Pin
Ramper30-Oct-06 8:07
Ramper30-Oct-06 8:07 
QuestionUse a MFC4.2 extension dll in vc2003.net, is that possible? Pin
Ralph.Law29-Oct-06 15:15
Ralph.Law29-Oct-06 15:15 
AnswerRe: Use a MFC4.2 extension dll in vc2003.net, is that possible? Pin
Mark Salsbery29-Oct-06 15:20
Mark Salsbery29-Oct-06 15:20 
GeneralRe: Use a MFC4.2 extension dll in vc2003.net, is that possible? Pin
Ralph.Law29-Oct-06 16:02
Ralph.Law29-Oct-06 16:02 
GeneralRe: Use a MFC4.2 extension dll in vc2003.net, is that possible? Pin
Mark Salsbery29-Oct-06 16:07
Mark Salsbery29-Oct-06 16:07 
GeneralRe: Use a MFC4.2 extension dll in vc2003.net, is that possible? Pin
Mark Salsbery29-Oct-06 16:09
Mark Salsbery29-Oct-06 16:09 
QuestionCFile::Write() and disk-full condition Pin
Le Thanh Cong29-Oct-06 14:55
Le Thanh Cong29-Oct-06 14:55 
AnswerRe: CFile::Write() and disk-full condition Pin
Mark Salsbery29-Oct-06 15:18
Mark Salsbery29-Oct-06 15:18 
GeneralRe: CFile::Write() and disk-full condition Pin
Le Thanh Cong29-Oct-06 15:23
Le Thanh Cong29-Oct-06 15:23 
GeneralRe: CFile::Write() and disk-full condition Pin
Mark Salsbery29-Oct-06 15:27
Mark Salsbery29-Oct-06 15:27 
GeneralRe: CFile::Write() and disk-full condition Pin
Le Thanh Cong29-Oct-06 16:12
Le Thanh Cong29-Oct-06 16:12 
QuestionInitCommonControls and XP visual style Pin
Le Thanh Cong29-Oct-06 14:46
Le Thanh Cong29-Oct-06 14:46 
QuestionWhy C++/CLI? Pin
Demian Panello29-Oct-06 14:28
Demian Panello29-Oct-06 14:28 
AnswerRe: Why C++/CLI? Pin
Mark Salsbery29-Oct-06 14:40
Mark Salsbery29-Oct-06 14:40 
AnswerRe: Why C++/CLI? Pin
Jun Du29-Oct-06 14:41
Jun Du29-Oct-06 14:41 
GeneralRe: Why C++/CLI? Pin
uusheikh29-Oct-06 22:34
uusheikh29-Oct-06 22:34 

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.