Help converting inputs.txt to outputs.txt

Pages: 1... 4567
closed account (48T7M4Gy)
Sacre bleu!

So all you need is just one extra variable attendA, attendB etc completely analogous to numA etc and that way this new average of A's = attendA/numA

Tell me I'm wrong. Please put me out of my misery ...
so i have this in this order:
- is this right?
- To get the solid Letter in its own column will i have to cout A,B,C,D,F in "
" in the same cout but press enter key and plae them underneath eachother?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 int CountAm = 0, CountBm = 0, CountCm = 0, CountA = 0, CountB = 0, CountC = 0, CountD = 0, CountF = 0, CountAp = 0, CountBp = 0, CountCp = 0;
    int TotalAm = 0, TotalBm = 0, TotalCm = 0, TotalA = 0, TotalB = 0, TotalC = 0, TotalD = 0, TotalF = 0, TotalAp = 0, TotalBp = 0, TotalCp = 0;

if (LetterGrade >= 97 && LetterGrade <= 100)
            {
                Grade = " A+ ";
                NumA++;
                CountAp++;
                TotalAp++;
            }
            else if (LetterGrade >= 93 && LetterGrade < 97)
            {
                Grade = " A ";
                NumA++;
                CountA++;
                TotalA++;
            }
            else if (LetterGrade >= 90 && LetterGrade < 93)
            {
                Grade = " A- ";
                NumA++;
                CountAm++;
                TotalAm++;
            }
            else if (LetterGrade >= 87 && LetterGrade < 90)
            {
                Grade = " B+ ";
                NumB++;
                CountBp++;
                TotalBp++;
            }
            else if (LetterGrade >= 83 && LetterGrade < 87)
            {
                Grade = " B ";
                NumB++;
                CountB++;
                TotalB++;
            }
            else if (LetterGrade >= 80 && LetterGrade < 83)
            {
                Grade = " B- ";
                NumB++;
                CountBm++;
                TotalBm++;
            }
            else if (LetterGrade >= 77 && LetterGrade < 80)
            {
                Grade = " C+ ";
                NumC++;
                CountCp++;
                TotalCp++;
            }
            else if (LetterGrade >= 73 && LetterGrade < 77)
            {
                Grade = " C ";
                NumC++;
                CountC++;
                TotalC++;
            }
            else if (LetterGrade >= 70 && LetterGrade < 73)
            {
                Grade = " C- ";
                NumC++;
                CountCm++;
                TotalCm++;
            }
            else if (LetterGrade >= 60 && LetterGrade < 70)
            {
                Grade = " D ";
                NumD++;
                CountD++;
                TotalD++;
            }
            else if (LetterGrade >= 0 && LetterGrade < 60)
            {
                Grade = " F ";
                NumF++;
                CountF++;
                TotalF++;
            }
          
            AvgAttendanceA = (TotalAp + TotalA + TotalAm) / (CountAp + CountA + CountAm);
            AvgAttendanceB = (TotalBp + TotalB + TotalBm) / (CountBp + CountB + CountBm);
            AvgAttendanceC = (TotalCp + TotalC +TotalCm) / (CountCp + CountC + CountCm);
            AvgAttendanceD = TotalD / CountD;
            AvgAttendanceF = TotalF / CountF;
Last edited on
for my count column.. which equation will add all the letters up ?

1
2
 TotalCountA = CountAp + CountA + CountAm;
  TotalCountA = TotalAp + TotalA + TotalAm;

Last edited on
wait im confused..
NumA++;
CountAm++;
TotalAm++;

- what is countam and totalam doing for me specifically? and what will attenda/numa specifaclly tell me lol... ill put you out of your misery soon. almost done ! :D
Last edited on
i have this. but when i ran it.. it immediately went "11db" into debugging mode i think and it was just mumbo jumbo green and blue mumbo jumbo D:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
double LetterGrade, AvgAttendanceA, AvgAttendanceB, AvgAttendanceC, AvgAttendanceD, AvgAttendanceF;
    double TotalCountA, TotalCountB, TotalCountC, TotalCountD, TotalCountF;

 int CountAm = 0, CountBm = 0, CountCm = 0, CountA = 0, CountB = 0, CountC = 0, CountD = 0, CountF = 0, CountAp = 0, CountBp = 0, CountCp = 0;
    int TotalAm = 0, TotalBm = 0, TotalCm = 0, TotalA = 0, TotalB = 0, TotalC = 0, TotalD = 0, TotalF = 0, TotalAp = 0, TotalBp = 0, TotalCp = 0;    

 if (LetterGrade >= 97 && LetterGrade <= 100)
            {
                Grade = " A+ ";
                NumA++;
                CountAp++;
                TotalAp++;
            }
            else if (LetterGrade >= 93 && LetterGrade < 97)
            {
                Grade = " A ";
                NumA++;
                CountA++;
                TotalA++;
            }
            else if (LetterGrade >= 90 && LetterGrade < 93)
            {
                Grade = " A- ";
                NumA++;
                CountAm++;
                TotalAm++;
            }
            else if (LetterGrade >= 87 && LetterGrade < 90)
            {
                Grade = " B+ ";
                NumB++;
                CountBp++;
                TotalBp++;
            }
            else if (LetterGrade >= 83 && LetterGrade < 87)
            {
                Grade = " B ";
                NumB++;
                CountB++;
                TotalB++;
            }
            else if (LetterGrade >= 80 && LetterGrade < 83)
            {
                Grade = " B- ";
                NumB++;
                CountBm++;
                TotalBm++;
            }
            else if (LetterGrade >= 77 && LetterGrade < 80)
            {
                Grade = " C+ ";
                NumC++;
                CountCp++;
                TotalCp++;
            }
            else if (LetterGrade >= 73 && LetterGrade < 77)
            {
                Grade = " C ";
                NumC++;
                CountC++;
                TotalC++;
            }
            else if (LetterGrade >= 70 && LetterGrade < 73)
            {
                Grade = " C- ";
                NumC++;
                CountCm++;
                TotalCm++;
            }
            else if (LetterGrade >= 60 && LetterGrade < 70)
            {
                Grade = " D ";
                NumD++;
                CountD++;
                TotalD++;
            }
            else if (LetterGrade >= 0 && LetterGrade < 60)
            {
                Grade = " F ";
                NumF++;
                CountF++;
                TotalF++;
            }
          
            AvgAttendanceA = (TotalAp + TotalA + TotalAm) / (CountAp + CountA + CountAm);
            AvgAttendanceB = (TotalBp + TotalB + TotalBm) / (CountBp + CountB + CountBm);
            AvgAttendanceC = (TotalCp + TotalC + TotalCm) / (CountCp + CountC + CountCm);
            AvgAttendanceD = TotalD / CountD;
            AvgAttendanceF = TotalF / CountF;
            
            
            
            TotalCountA = TotalAp + TotalA + TotalAm;
            TotalCountB = TotalBp + TotalB + TotalBm;
            TotalCountC = TotalCp + TotalC + TotalCm;
            TotalCountD = TotalD;
            TotalCountF = TotalF;
            
            
            cout << '\t' << TotalCountA << '\t' << AvgAttendanceA << endl;
            cout << '\t' << TotalCountB << '\t' << AvgAttendanceB << endl;
            cout << '\t' << TotalCountC << '\t' << AvgAttendanceC << endl;
            cout << '\t' << TotalCountD << '\t' << AvgAttendanceD << endl;
            cout << '\t' << TotalCountF << '\t' << AvgAttendanceF << endl;
Last edited on
closed account (48T7M4Gy)
Actually Total in any category is the total attendance mark so Total++ should really be something like Total += Attendance

But instead of me telling you, it is better you have a clear picture of what the end result is supposed to be. Forget about coding and formatting and how to do it. Just decide what you want as the outcome. At the moment this is just dancing around some invisible spot. :)

very true :p ok. so i have my output.txt done. that is in the past. bye bye.
what i need now is this:
1. have the first column with just the letters A,B,C,D,F. i can do that.
2. 2nd column must be "Count" with the number of people with the specific letter grade in that row.
3. The avg attendance of the people (Count) who got that letter grade in that row

- it should look like this as an example
Letter   Count    Avg.Attendance
A            22           20
B            40            17
C            30           16
D            21           12
F             8             10
Last edited on
closed account (48T7M4Gy)
OK because the other way was this, it just depends what u want. Now that u are clear that is a +

I
D     Course  Letter
       Grade   Grade
1	80.5	 B- 
2	27.5	 F 
3	97.525	 A+ 
4	96.5075	 A 
5	80.64	 B- 
6	89.1775	 B+ 
7	73.84	 C 
8	91.4825	 A- 
9	73.5	 C 
10	77.6	 C+ 
The # of A's: 3
The # of B's: 3
The # of C's: 3
The # of D's: 0
The # of F's: 1
A+'s: 1 students. Average attendance marks: 24
 A's: 1 students. Average attendance marks: 25
A-'s: 1 students. Average attendance marks: 25
B+'s: 1 students. Average attendance marks: 24
 B's: 0 students. Average attendance marks: -nan(ind)
B-'s: 2 students. Average attendance marks: 15
C+'s: 1 students. Average attendance marks: 24
 C's: 2 students. Average attendance marks: 20
C-'s: 0 students. Average attendance marks: -nan(ind)
 D's: 0 students. Average attendance marks: -nan(ind)
 F's: 1 students. Average attendance marks: 8

Last edited on
i need both
i need this in the ouput.txt ignore the "The number of A's" ill delete that part:
1
2
3
4
5
6
7
8
9
10
11
12
ID     Course  Letter
       Grade   Grade
1	80.5	 B- 
2	27.5	 F 
3	97.525	 A+ 
4	96.5075	 A 
5	80.64	 B- 
6	89.1775	 B+ 
7	73.84	 C 
8	91.4825	 A- 
9	73.5	 C 
10	77.6	 C+ 
i need that ^ in the output.txt and this below in the xcode output (cout)

Letter   Count    Avg.Attendance
A            22           20
B            40            17
C            30           16
D            21           12
F             8             10

closed account (48T7M4Gy)
This of course can be simplified because of the change in aggregation but the essence is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
outputGrades << "The # of A's: " << NumA << endl;
		outputGrades << "The # of B's: " << NumB << endl;
		outputGrades << "The # of C's: " << NumC << endl;
		outputGrades << "The # of D's: " << NumD << endl;
		outputGrades << "The # of F's: " << NumF << endl;


		outputGrades << "A+'s: " << countAp << " students. Average attendance marks: " << attendAp / countAp << endl;
		outputGrades << " A's: " << countA <<  " students. Average attendance marks: " << attendA  / countA << endl;
		outputGrades << "A-'s: " << countAm<<  " students. Average attendance marks: " << attendAm / countAm << endl;

		outputGrades << "B+'s: " << countBp << " students. Average attendance marks: " << attendBp / countBp << endl;
		outputGrades << " B's: " << countB <<  " students. Average attendance marks: " << attendB  / countB << endl;
		outputGrades << "B-'s: " << countBm << " students. Average attendance marks: " << attendBm / countBm << endl;

		outputGrades << "C+'s: " << countCp << " students. Average attendance marks: " << attendCp / countCp << endl;
		outputGrades << " C's: " << countC <<  " students. Average attendance marks: " << attendC  / countC << endl;
		outputGrades << "C-'s: " << countCm << " students. Average attendance marks: " << attendCm / countCm << endl;

		outputGrades << " D's: " << countD <<  " students. Average attendance marks: " << attendD  / countD << endl;

		outputGrades << " F's: " << countF <<  " students. Average attendance marks: " << attendF  / countF << endl;

		outputGrades << "Letter   Count    Avg    " << endl;
		outputGrades << "Letter   Count Attendance" << endl;
		outputGrades << "  A" << '\t' << countAp + countA + countAm << '\t' << ( attendAp + attendA + attendAm )/ (countAp + countA + countAm) << endl;
		outputGrades << "  B" << '\t' << countBp + countB + countBm << '\t' << (attendBp + attendB + attendBm) / (countBp + countB + countBm) << endl;
		outputGrades << "  C" << '\t' << countCp + countC + countCm << '\t' << (attendCp + attendC + attendCm) / (countCp + countC + countCm) << endl;
		outputGrades << "  D" << '\t' << countD << '\t' << attendD / countD << endl;
		outputGrades << "  F" << '\t' << countF << '\t' << attendF / countF<< endl;


A's: 1 students. Average attendance marks: 25
A-'s: 1 students. Average attendance marks: 25
B+'s: 1 students. Average attendance marks: 24
 B's: 0 students. Average attendance marks: -nan(ind)
B-'s: 2 students. Average attendance marks: 15
C+'s: 1 students. Average attendance marks: 24
 C's: 2 students. Average attendance marks: 20
C-'s: 0 students. Average attendance marks: -nan(ind)
 D's: 0 students. Average attendance marks: -nan(ind)
 F's: 1 students. Average attendance marks: 8
Letter   Count    Avg    
Letter   Count Attendance
  A	3	24.6667
  B	3	18
  C	3	21.3333
  D	0	-nan(ind)
  F	1	8

Last edited on
ok i need all of that to be cout << instead of outputgrades. my ouputgrades << is perfect for what i needed done for it.
also i notice that your numbers say only 3 A's 3 B's etc. There are 137 students so are you sure that is right ? or was that just a sample.
Also your attend's are my Totals correct?

i only need this part for my xcode output:

Letter   Count Attendance
  A	3	24.6667
  B	3	18
  C	3	21.3333
  D	0	-nan(ind)
  F	1	8


Last edited on
so i am good with my equations and variable selections?
here is my code just to test it ill change once i know it works but.. what the heck.... it keeps going into 11db mode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include<fstream>
#include<iomanip>
#include<string>
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
    
    
    ifstream sampleGrades4("sampleGrades4.txt");
    ofstream outputGrades("outputgrades.txt");
    
    string firstRow;
    int TotalStudents;
    
    double Attendance;
    double hw1, hw2, hw3, hw4, hw5, hw6, hw7, exam1, exam2, finalExam;
    double LetterGrade, AvgAttendanceA = 0.0, AvgAttendanceB = 0.0, AvgAttendanceC = 0.0, AvgAttendanceD = 0.0, AvgAttendanceF = 0.0;
    double TotalCountA = 0, TotalCountB = 0, TotalCountC = 0, TotalCountD = 0, TotalCountF = 0.0;
   
    int ID = 0;
    int NumA = 0;
    int NumB = 0;
    int NumC = 0;
    int NumD = 0;
    int NumF = 0;
    int CountAm = 0, CountBm = 0, CountCm = 0, CountA = 0, CountB = 0, CountC = 0, CountD = 0, CountF = 0, CountAp = 0, CountBp = 0, CountCp = 0;
    int TotalAm = 0, TotalBm = 0, TotalCm = 0, TotalA = 0, TotalB = 0, TotalC = 0, TotalD = 0, TotalF = 0, TotalAp = 0, TotalBp = 0, TotalCp = 0;
    
    string Grade = "";
  
    if (sampleGrades4.is_open())
    {
        getline(sampleGrades4, firstRow);
        
        sampleGrades4 >> TotalStudents;
        cout << "Number of Students: " << TotalStudents << endl;
        
        cout << firstRow << endl;
        
        outputGrades << "ID" << setw(14) << "Course Letter" << setw(17) << "Letter Grade" << endl;
        cout << "Letter" << '\t' << "Count" << '\t' << "AvgAttendance" << endl;
       
        
        while ( !sampleGrades4.eof() )
        {
            sampleGrades4 >> ID >> Attendance >> hw1 >> hw2 >> hw3 >> hw4 >> hw5 >> hw6 >> hw7 >> exam1 >> exam2 >> finalExam;
            
            Grade = "Error: This is wrong !";
           
            LetterGrade = 100*(Attendance*0.10/25 + (hw1 + hw2 + hw3 + hw4 + hw5 + hw6 + hw7)/700*0.35 + exam1/25*0.15 + exam2/25*0.15 + finalExam/40*0.25);
        
        
            if (LetterGrade >= 97 && LetterGrade <= 100)
            {
                Grade = " A+ ";
                NumA++;
                CountAp++;
                TotalAp++;
            }
            else if (LetterGrade >= 93 && LetterGrade < 97)
            {
                Grade = " A ";
                NumA++;
                CountA++;
                TotalA++;
            }
            else if (LetterGrade >= 90 && LetterGrade < 93)
            {
                Grade = " A- ";
                NumA++;
                CountAm++;
                TotalAm++;
            }
            else if (LetterGrade >= 87 && LetterGrade < 90)
            {
                Grade = " B+ ";
                NumB++;
                CountBp++;
                TotalBp++;
            }
            else if (LetterGrade >= 83 && LetterGrade < 87)
            {
                Grade = " B ";
                NumB++;
                CountB++;
                TotalB++;
            }
            else if (LetterGrade >= 80 && LetterGrade < 83)
            {
                Grade = " B- ";
                NumB++;
                CountBm++;
                TotalBm++;
            }
            else if (LetterGrade >= 77 && LetterGrade < 80)
            {
                Grade = " C+ ";
                NumC++;
                CountCp++;
                TotalCp++;
            }
            else if (LetterGrade >= 73 && LetterGrade < 77)
            {
                Grade = " C ";
                NumC++;
                CountC++;
                TotalC++;
            }
            else if (LetterGrade >= 70 && LetterGrade < 73)
            {
                Grade = " C- ";
                NumC++;
                CountCm++;
                TotalCm++;
            }
            else if (LetterGrade >= 60 && LetterGrade < 70)
            {
                Grade = " D ";
                NumD++;
                CountD++;
                TotalD++;
            }
            else if (LetterGrade >= 0 && LetterGrade < 60)
            {
                Grade = " F ";
                NumF++;
                CountF++;
                TotalF++;
            }
          
            cout << "Letter   Count    Avg    " <<
                    "Letter   Count Attendance" << endl;
            cout << "  A" << '\t' << CountAp + CountA + CountAm << '\t' << ( TotalAp + TotalA + TotalAm )/ (CountAp + CountA + CountAm) << endl;
            cout << "  B" << '\t' << CountBp + CountB + CountBm << '\t' << (TotalBp + TotalB + TotalBm) / (CountBp + CountB + CountBm) << endl;
            cout << "  C" << '\t' << CountCp + CountC + CountCm << '\t' << (TotalCp + TotalC + TotalCm) / (CountCp + CountC + CountCm) << endl;
            cout << "  D" << '\t' << CountD << '\t' << TotalD / CountD << endl;
            cout << "  F" << '\t' << CountF << '\t' << TotalF / CountF<< endl;
        
            
            
            outputGrades << ID << '\t' << setprecision(2) << fixed << LetterGrade << '\t' << '\t' << Grade << endl;
            
        }
        
        
        outputGrades << endl;
        outputGrades << "The # of A's: " << NumA << endl;
        outputGrades << "The # of B's: " << NumB << endl;
        outputGrades << "The # of C's: " << NumC << endl;
        outputGrades << "The # of D's: " << NumC << endl;
        outputGrades << "The # of F's: " << NumF << endl;
        
        sampleGrades4.close();
        outputGrades.close();
    }
    else
        cout << "Unable to open file";
    
    return 0;
}
Last edited on
closed account (48T7M4Gy)
so i am good with my equations and variable selections?


I'd say so, keeping in mind I am not using the full data set of 137 students. I only have (and want) 10.
omg. now my output.txt file numbers are all gone !! is it because i added the extra Count++ Total++ ??
my output.txt file was perfect with what it was when it was just Num++

but i need my xcode to ouput to its own screen the 3 columns that ive been asking for help about :/
ok so i had my code perfect for my output,txt file when my code was this below:
-but starting from there without altering the output.txt file. i need to calculate the avg attendance for the number of students with the 5 specific grades and have that ouputted to my XCODE screen. my ouput,.txt is perfect when my code is this below. i just need to have it "cout" the 3 columns in xcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include<fstream>
#include<iomanip>
#include<string>
#include<iostream>
#include<cmath>

using namespace std;

int main()
{
    
    
    ifstream sampleGrades4("sampleGrades4.txt");
    ofstream outputGrades("outputgrades.txt");
    
    string firstRow;
    int TotalStudents;
    
    double Attendance;
    double hw1, hw2, hw3, hw4, hw5, hw6, hw7, exam1, exam2, finalExam;
    double LetterGrade, AvgAttendance;
    
    int ID = 0;
    int NumA = 0;
    int NumB = 0;
    int NumC = 0;
    int NumD = 0;
    int NumF = 0;
    int Count = 0;
    
    string Grade = "";
    
    
    if (sampleGrades4.is_open())
    {
        getline(sampleGrades4, firstRow);
        
        sampleGrades4 >> TotalStudents;
        cout << "Number of Students: " << TotalStudents << endl;
        
        cout << firstRow << endl;
        
        outputGrades << "ID" << setw(14) << "Course Letter" << setw(17) << "Letter Grade" << endl;
       
        
        while ( !sampleGrades4.eof() )
        {
            sampleGrades4 >> ID >> Attendance >> hw1 >> hw2 >> hw3 >> hw4 >> hw5 >> hw6 >> hw7 >> exam1 >> exam2 >> finalExam;
            
            Grade = "Error: This is wrong !";
           
            LetterGrade = 100*(Attendance*0.10/25 + (hw1 + hw2 + hw3 + hw4 + hw5 + hw6 + hw7)/700*0.35 + exam1/25*0.15 + exam2/25*0.15 + finalExam/40*0.25);
            
            AvgAttendance = Attendance/25*NumA;
            cout << "Letter" << '\t' << "Count" << '\t' << "AvgAttendance" << endl;
            
        
            if (LetterGrade >= 97 && LetterGrade <= 100)
            {
                Grade = " A+ ";
                NumA++;
            }
            else if (LetterGrade >= 93 && LetterGrade < 97)
            {
                Grade = " A ";
                NumA++;
            }
            else if (LetterGrade >= 90 && LetterGrade < 93)
            {
                Grade = " A- ";
                NumA++;
            }
            else if (LetterGrade >= 87 && LetterGrade < 90)
            {
                Grade = " B+ ";
                NumB++;
            }
            else if (LetterGrade >= 83 && LetterGrade < 87)
            {
                Grade = " B ";
                NumB++;
            }
            else if (LetterGrade >= 80 && LetterGrade < 83)
            {
                Grade = " B- ";
                NumB++;
            }
            else if (LetterGrade >= 77 && LetterGrade < 80)
            {
                Grade = " C+ ";
                NumC++;
            }
            else if (LetterGrade >= 73 && LetterGrade < 77)
            {
                Grade = " C ";
                NumC++;
            }
            else if (LetterGrade >= 70 && LetterGrade < 73)
            {
                Grade = " C- ";
                NumC++;
            }
            else if (LetterGrade >= 60 && LetterGrade < 70)
            {
                Grade = " D ";
                NumD++;
            }
            else if (LetterGrade >= 0 && LetterGrade < 60)
            {
                Grade = " F ";
                NumF++;
            }
          

            outputGrades << ID << '\t' << setprecision(2) << fixed << LetterGrade << '\t' << '\t' << Grade << endl;
            
            cout << Grade << '\t' << Count << '\t' << AvgAttendance << endl;
            
            
        }
        
        sampleGrades4.close();
        outputGrades.close();
    }
    else
        cout << "Unable to open file";
    
    return 0;
}
im so lost :/ when i added the Count++ and Total++ it now shows nothing in my output.txt file which was perfect. Maybe i have to return 0 in the middle of my code so i can have the Letter | Count | avg.attendance column calculations print it only in my xcode screen without altering my ouput.txt file. would that help ??
I'd just like to take a moment to appreciate kemort

... moment taken?

Good, he's a boss.

@Phil

I think you're both overthinking and underthinking your problem. Frustration is probably your biggest enemy right now, the next step I'd take in your shoes is to step through your code and perhaps break your equation into a couple sub steps so you can see what's actually happening there. You have the option of using software to step through your code, instead I would use good old fashioned pencil and paper, write out a single student, the values that you see, and the values you should see, and the solution will probably be easier to grasp.

Don't worry, you can do it. Think about your solution, and use the tools that you have to come up with a method of reaching it. You're very close to your answer.

Now, you may only have a limited subset of functions to work with currently, but as you progress this kind of problem will be easy street- again, don't worry, I believe in you!
Pages: 1... 4567