C - Larger Output Than I have in File (Size Problem)












0















I have a file, with format:



Course - Grade Count - Grades



Programming 10 3 4 5 4 3 2 4 5 2 3
Mathematics 8 3 3 4 5 3 2 2 3
Physics 6 3 4 5 3 4 5
Design 6 5 4 5 3 2 4
Logistics 8 3 4 5 3 1 1 2 4


Ex: Course - Programming, Grade Count - 10 and Grades - 3 4 5 4 3 2 4 5 2 3



I already have



#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define SIZE 70

int main(void)
{
char subject[SIZE];
int gradeCount;
int grades[SIZE];

FILE *fp = fopen("C:\Project\project.txt", "r"); //opening already created file


if (fp == NULL) {
perror("Error opening file");
return(-1);
}

for (int i = 0; i < SIZE; i++) {

fscanf(fp, "%s %d", &subject[i], &gradeCount);
printf("%s n", &subject[i]);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d n" , grades[k]);

}

if (i == SIZE) {
break;
}
}

fclose(fp);
return 0;
}


I need to print out "Course", "Grade Count" and "Grades" without any problems, later on I need to make a search and so I need to separate them from each other, but that is not the case, now I will show you the outputs for all cases, when I output first "Subject/Course" then "Grade Count" and finally "Grades".



For Courses:



Programming
Mathematics
Physics
Design
Logistics
ogistics
gistics
istics
stics
tics
ics
cs
s

@

@@
@
@


For Grade Count:



10
8
6
6
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8


And for Grades:



3
4
5
4
3
2
4
5
2
3
3
3
4
5
3
2
2
3
3
4
5
3
4
5
5
4
5
3
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4


In all cases, additional things are added to original stuff that should be printed out, I don't know where it comes from, I thought about pointers, but don't know much about them. Any suggestions?



Just need to print everything normally to normally search for everything (Courses, grade count and grades) later on.










share|improve this question

























  • Start by adding error checking to your code; especially with fscanf().

    – Shawn
    Nov 21 '18 at 13:13











  • Suspect you've mis-declared subject - it looks like you're expecting it to be an array of strings, but instead you've just got it as a string.

    – Chris Turner
    Nov 21 '18 at 13:18











  • if (i == SIZE) in your loop will never happen because you only loop while i < SIZE. You have to think about a better way to exit the loop if there is no more input.

    – Swordfish
    Nov 21 '18 at 13:20











  • @ChrisTurner Array of chars and it should be a string, that is the idea.

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:20











  • A string is an array of chars. A array of strings is an array of arrays of chars.

    – Swordfish
    Nov 21 '18 at 13:21
















0















I have a file, with format:



Course - Grade Count - Grades



Programming 10 3 4 5 4 3 2 4 5 2 3
Mathematics 8 3 3 4 5 3 2 2 3
Physics 6 3 4 5 3 4 5
Design 6 5 4 5 3 2 4
Logistics 8 3 4 5 3 1 1 2 4


Ex: Course - Programming, Grade Count - 10 and Grades - 3 4 5 4 3 2 4 5 2 3



I already have



#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define SIZE 70

int main(void)
{
char subject[SIZE];
int gradeCount;
int grades[SIZE];

FILE *fp = fopen("C:\Project\project.txt", "r"); //opening already created file


if (fp == NULL) {
perror("Error opening file");
return(-1);
}

for (int i = 0; i < SIZE; i++) {

fscanf(fp, "%s %d", &subject[i], &gradeCount);
printf("%s n", &subject[i]);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d n" , grades[k]);

}

if (i == SIZE) {
break;
}
}

fclose(fp);
return 0;
}


I need to print out "Course", "Grade Count" and "Grades" without any problems, later on I need to make a search and so I need to separate them from each other, but that is not the case, now I will show you the outputs for all cases, when I output first "Subject/Course" then "Grade Count" and finally "Grades".



For Courses:



Programming
Mathematics
Physics
Design
Logistics
ogistics
gistics
istics
stics
tics
ics
cs
s

@

@@
@
@


For Grade Count:



10
8
6
6
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8


And for Grades:



3
4
5
4
3
2
4
5
2
3
3
3
4
5
3
2
2
3
3
4
5
3
4
5
5
4
5
3
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4


In all cases, additional things are added to original stuff that should be printed out, I don't know where it comes from, I thought about pointers, but don't know much about them. Any suggestions?



Just need to print everything normally to normally search for everything (Courses, grade count and grades) later on.










share|improve this question

























  • Start by adding error checking to your code; especially with fscanf().

    – Shawn
    Nov 21 '18 at 13:13











  • Suspect you've mis-declared subject - it looks like you're expecting it to be an array of strings, but instead you've just got it as a string.

    – Chris Turner
    Nov 21 '18 at 13:18











  • if (i == SIZE) in your loop will never happen because you only loop while i < SIZE. You have to think about a better way to exit the loop if there is no more input.

    – Swordfish
    Nov 21 '18 at 13:20











  • @ChrisTurner Array of chars and it should be a string, that is the idea.

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:20











  • A string is an array of chars. A array of strings is an array of arrays of chars.

    – Swordfish
    Nov 21 '18 at 13:21














0












0








0








I have a file, with format:



Course - Grade Count - Grades



Programming 10 3 4 5 4 3 2 4 5 2 3
Mathematics 8 3 3 4 5 3 2 2 3
Physics 6 3 4 5 3 4 5
Design 6 5 4 5 3 2 4
Logistics 8 3 4 5 3 1 1 2 4


Ex: Course - Programming, Grade Count - 10 and Grades - 3 4 5 4 3 2 4 5 2 3



I already have



#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define SIZE 70

int main(void)
{
char subject[SIZE];
int gradeCount;
int grades[SIZE];

FILE *fp = fopen("C:\Project\project.txt", "r"); //opening already created file


if (fp == NULL) {
perror("Error opening file");
return(-1);
}

for (int i = 0; i < SIZE; i++) {

fscanf(fp, "%s %d", &subject[i], &gradeCount);
printf("%s n", &subject[i]);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d n" , grades[k]);

}

if (i == SIZE) {
break;
}
}

fclose(fp);
return 0;
}


I need to print out "Course", "Grade Count" and "Grades" without any problems, later on I need to make a search and so I need to separate them from each other, but that is not the case, now I will show you the outputs for all cases, when I output first "Subject/Course" then "Grade Count" and finally "Grades".



For Courses:



Programming
Mathematics
Physics
Design
Logistics
ogistics
gistics
istics
stics
tics
ics
cs
s

@

@@
@
@


For Grade Count:



10
8
6
6
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8


And for Grades:



3
4
5
4
3
2
4
5
2
3
3
3
4
5
3
2
2
3
3
4
5
3
4
5
5
4
5
3
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4


In all cases, additional things are added to original stuff that should be printed out, I don't know where it comes from, I thought about pointers, but don't know much about them. Any suggestions?



Just need to print everything normally to normally search for everything (Courses, grade count and grades) later on.










share|improve this question
















I have a file, with format:



Course - Grade Count - Grades



Programming 10 3 4 5 4 3 2 4 5 2 3
Mathematics 8 3 3 4 5 3 2 2 3
Physics 6 3 4 5 3 4 5
Design 6 5 4 5 3 2 4
Logistics 8 3 4 5 3 1 1 2 4


Ex: Course - Programming, Grade Count - 10 and Grades - 3 4 5 4 3 2 4 5 2 3



I already have



#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define SIZE 70

int main(void)
{
char subject[SIZE];
int gradeCount;
int grades[SIZE];

FILE *fp = fopen("C:\Project\project.txt", "r"); //opening already created file


if (fp == NULL) {
perror("Error opening file");
return(-1);
}

for (int i = 0; i < SIZE; i++) {

fscanf(fp, "%s %d", &subject[i], &gradeCount);
printf("%s n", &subject[i]);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d n" , grades[k]);

}

if (i == SIZE) {
break;
}
}

fclose(fp);
return 0;
}


I need to print out "Course", "Grade Count" and "Grades" without any problems, later on I need to make a search and so I need to separate them from each other, but that is not the case, now I will show you the outputs for all cases, when I output first "Subject/Course" then "Grade Count" and finally "Grades".



For Courses:



Programming
Mathematics
Physics
Design
Logistics
ogistics
gistics
istics
stics
tics
ics
cs
s

@

@@
@
@


For Grade Count:



10
8
6
6
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8


And for Grades:



3
4
5
4
3
2
4
5
2
3
3
3
4
5
3
2
2
3
3
4
5
3
4
5
5
4
5
3
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4
3
4
5
3
1
1
2
4


In all cases, additional things are added to original stuff that should be printed out, I don't know where it comes from, I thought about pointers, but don't know much about them. Any suggestions?



Just need to print everything normally to normally search for everything (Courses, grade count and grades) later on.







c arrays scanf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 13:18









Swordfish

1




1










asked Nov 21 '18 at 13:08









Aleksandre SikharulidzeAleksandre Sikharulidze

225




225













  • Start by adding error checking to your code; especially with fscanf().

    – Shawn
    Nov 21 '18 at 13:13











  • Suspect you've mis-declared subject - it looks like you're expecting it to be an array of strings, but instead you've just got it as a string.

    – Chris Turner
    Nov 21 '18 at 13:18











  • if (i == SIZE) in your loop will never happen because you only loop while i < SIZE. You have to think about a better way to exit the loop if there is no more input.

    – Swordfish
    Nov 21 '18 at 13:20











  • @ChrisTurner Array of chars and it should be a string, that is the idea.

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:20











  • A string is an array of chars. A array of strings is an array of arrays of chars.

    – Swordfish
    Nov 21 '18 at 13:21



















  • Start by adding error checking to your code; especially with fscanf().

    – Shawn
    Nov 21 '18 at 13:13











  • Suspect you've mis-declared subject - it looks like you're expecting it to be an array of strings, but instead you've just got it as a string.

    – Chris Turner
    Nov 21 '18 at 13:18











  • if (i == SIZE) in your loop will never happen because you only loop while i < SIZE. You have to think about a better way to exit the loop if there is no more input.

    – Swordfish
    Nov 21 '18 at 13:20











  • @ChrisTurner Array of chars and it should be a string, that is the idea.

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:20











  • A string is an array of chars. A array of strings is an array of arrays of chars.

    – Swordfish
    Nov 21 '18 at 13:21

















Start by adding error checking to your code; especially with fscanf().

– Shawn
Nov 21 '18 at 13:13





Start by adding error checking to your code; especially with fscanf().

– Shawn
Nov 21 '18 at 13:13













Suspect you've mis-declared subject - it looks like you're expecting it to be an array of strings, but instead you've just got it as a string.

– Chris Turner
Nov 21 '18 at 13:18





Suspect you've mis-declared subject - it looks like you're expecting it to be an array of strings, but instead you've just got it as a string.

– Chris Turner
Nov 21 '18 at 13:18













if (i == SIZE) in your loop will never happen because you only loop while i < SIZE. You have to think about a better way to exit the loop if there is no more input.

– Swordfish
Nov 21 '18 at 13:20





if (i == SIZE) in your loop will never happen because you only loop while i < SIZE. You have to think about a better way to exit the loop if there is no more input.

– Swordfish
Nov 21 '18 at 13:20













@ChrisTurner Array of chars and it should be a string, that is the idea.

– Aleksandre Sikharulidze
Nov 21 '18 at 13:20





@ChrisTurner Array of chars and it should be a string, that is the idea.

– Aleksandre Sikharulidze
Nov 21 '18 at 13:20













A string is an array of chars. A array of strings is an array of arrays of chars.

– Swordfish
Nov 21 '18 at 13:21





A string is an array of chars. A array of strings is an array of arrays of chars.

– Swordfish
Nov 21 '18 at 13:21












1 Answer
1






active

oldest

votes


















0














You need to exit the loop early if it fails to read anything in. You can do that by checking the return value of fscanf. If the first call doesn't return 2, you know that it didn't read in 2 values and can break out of the loop.



You're also calling fscanf and printf incorrectly for dealing with a string. You are moving the starting point of where you read into/print from, which isn't needed and reduces the maximum space available to you.



Updated code looks something like this



for (int i = 0; i < SIZE; i++) {
if(fscanf(fp, "%s %d", subject, &gradeCount) != 2) {
break;
}

printf("%s ", subject);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d" , grades[k]);
}
}





share|improve this answer
























  • I used it, but it outputs something mixed, it gives me all the subjects and it is good, but it mixes with grades, but incomplete and incorrect amount of grades, grade count should be just 1 number for each course

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:51











  • I'm not sure I follow - the code I've included should just print out each subject. It doesn't print out gradeCount or the grades as those lines are commented out.

    – Chris Turner
    Nov 21 '18 at 13:55











  • I understand and that is the main reason of this question, it just acts strangely. This is the output I get. Programming 3 5 3 4 2 Mathematics 3 4 3 2 Physics 3 5 4 Design 5 5 2 Logistics 3 5 1 2

    – Aleksandre Sikharulidze
    Nov 21 '18 at 14:01








  • 1





    If that's the output you're getting, then you're not running the code included in the question, with or without my changes. If I run that code I get just "Programming Mathematics Physics Design Logistics"

    – Chris Turner
    Nov 21 '18 at 14:25











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412774%2fc-larger-output-than-i-have-in-file-size-problem%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You need to exit the loop early if it fails to read anything in. You can do that by checking the return value of fscanf. If the first call doesn't return 2, you know that it didn't read in 2 values and can break out of the loop.



You're also calling fscanf and printf incorrectly for dealing with a string. You are moving the starting point of where you read into/print from, which isn't needed and reduces the maximum space available to you.



Updated code looks something like this



for (int i = 0; i < SIZE; i++) {
if(fscanf(fp, "%s %d", subject, &gradeCount) != 2) {
break;
}

printf("%s ", subject);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d" , grades[k]);
}
}





share|improve this answer
























  • I used it, but it outputs something mixed, it gives me all the subjects and it is good, but it mixes with grades, but incomplete and incorrect amount of grades, grade count should be just 1 number for each course

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:51











  • I'm not sure I follow - the code I've included should just print out each subject. It doesn't print out gradeCount or the grades as those lines are commented out.

    – Chris Turner
    Nov 21 '18 at 13:55











  • I understand and that is the main reason of this question, it just acts strangely. This is the output I get. Programming 3 5 3 4 2 Mathematics 3 4 3 2 Physics 3 5 4 Design 5 5 2 Logistics 3 5 1 2

    – Aleksandre Sikharulidze
    Nov 21 '18 at 14:01








  • 1





    If that's the output you're getting, then you're not running the code included in the question, with or without my changes. If I run that code I get just "Programming Mathematics Physics Design Logistics"

    – Chris Turner
    Nov 21 '18 at 14:25
















0














You need to exit the loop early if it fails to read anything in. You can do that by checking the return value of fscanf. If the first call doesn't return 2, you know that it didn't read in 2 values and can break out of the loop.



You're also calling fscanf and printf incorrectly for dealing with a string. You are moving the starting point of where you read into/print from, which isn't needed and reduces the maximum space available to you.



Updated code looks something like this



for (int i = 0; i < SIZE; i++) {
if(fscanf(fp, "%s %d", subject, &gradeCount) != 2) {
break;
}

printf("%s ", subject);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d" , grades[k]);
}
}





share|improve this answer
























  • I used it, but it outputs something mixed, it gives me all the subjects and it is good, but it mixes with grades, but incomplete and incorrect amount of grades, grade count should be just 1 number for each course

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:51











  • I'm not sure I follow - the code I've included should just print out each subject. It doesn't print out gradeCount or the grades as those lines are commented out.

    – Chris Turner
    Nov 21 '18 at 13:55











  • I understand and that is the main reason of this question, it just acts strangely. This is the output I get. Programming 3 5 3 4 2 Mathematics 3 4 3 2 Physics 3 5 4 Design 5 5 2 Logistics 3 5 1 2

    – Aleksandre Sikharulidze
    Nov 21 '18 at 14:01








  • 1





    If that's the output you're getting, then you're not running the code included in the question, with or without my changes. If I run that code I get just "Programming Mathematics Physics Design Logistics"

    – Chris Turner
    Nov 21 '18 at 14:25














0












0








0







You need to exit the loop early if it fails to read anything in. You can do that by checking the return value of fscanf. If the first call doesn't return 2, you know that it didn't read in 2 values and can break out of the loop.



You're also calling fscanf and printf incorrectly for dealing with a string. You are moving the starting point of where you read into/print from, which isn't needed and reduces the maximum space available to you.



Updated code looks something like this



for (int i = 0; i < SIZE; i++) {
if(fscanf(fp, "%s %d", subject, &gradeCount) != 2) {
break;
}

printf("%s ", subject);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d" , grades[k]);
}
}





share|improve this answer













You need to exit the loop early if it fails to read anything in. You can do that by checking the return value of fscanf. If the first call doesn't return 2, you know that it didn't read in 2 values and can break out of the loop.



You're also calling fscanf and printf incorrectly for dealing with a string. You are moving the starting point of where you read into/print from, which isn't needed and reduces the maximum space available to you.



Updated code looks something like this



for (int i = 0; i < SIZE; i++) {
if(fscanf(fp, "%s %d", subject, &gradeCount) != 2) {
break;
}

printf("%s ", subject);
//printf("%d n", gradeCount);
for (int k = 0; k < gradeCount; k++)
{
fscanf(fp, "%d", &grades[k]);
// printf("%d" , grades[k]);
}
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '18 at 13:40









Chris TurnerChris Turner

7,31211118




7,31211118













  • I used it, but it outputs something mixed, it gives me all the subjects and it is good, but it mixes with grades, but incomplete and incorrect amount of grades, grade count should be just 1 number for each course

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:51











  • I'm not sure I follow - the code I've included should just print out each subject. It doesn't print out gradeCount or the grades as those lines are commented out.

    – Chris Turner
    Nov 21 '18 at 13:55











  • I understand and that is the main reason of this question, it just acts strangely. This is the output I get. Programming 3 5 3 4 2 Mathematics 3 4 3 2 Physics 3 5 4 Design 5 5 2 Logistics 3 5 1 2

    – Aleksandre Sikharulidze
    Nov 21 '18 at 14:01








  • 1





    If that's the output you're getting, then you're not running the code included in the question, with or without my changes. If I run that code I get just "Programming Mathematics Physics Design Logistics"

    – Chris Turner
    Nov 21 '18 at 14:25



















  • I used it, but it outputs something mixed, it gives me all the subjects and it is good, but it mixes with grades, but incomplete and incorrect amount of grades, grade count should be just 1 number for each course

    – Aleksandre Sikharulidze
    Nov 21 '18 at 13:51











  • I'm not sure I follow - the code I've included should just print out each subject. It doesn't print out gradeCount or the grades as those lines are commented out.

    – Chris Turner
    Nov 21 '18 at 13:55











  • I understand and that is the main reason of this question, it just acts strangely. This is the output I get. Programming 3 5 3 4 2 Mathematics 3 4 3 2 Physics 3 5 4 Design 5 5 2 Logistics 3 5 1 2

    – Aleksandre Sikharulidze
    Nov 21 '18 at 14:01








  • 1





    If that's the output you're getting, then you're not running the code included in the question, with or without my changes. If I run that code I get just "Programming Mathematics Physics Design Logistics"

    – Chris Turner
    Nov 21 '18 at 14:25

















I used it, but it outputs something mixed, it gives me all the subjects and it is good, but it mixes with grades, but incomplete and incorrect amount of grades, grade count should be just 1 number for each course

– Aleksandre Sikharulidze
Nov 21 '18 at 13:51





I used it, but it outputs something mixed, it gives me all the subjects and it is good, but it mixes with grades, but incomplete and incorrect amount of grades, grade count should be just 1 number for each course

– Aleksandre Sikharulidze
Nov 21 '18 at 13:51













I'm not sure I follow - the code I've included should just print out each subject. It doesn't print out gradeCount or the grades as those lines are commented out.

– Chris Turner
Nov 21 '18 at 13:55





I'm not sure I follow - the code I've included should just print out each subject. It doesn't print out gradeCount or the grades as those lines are commented out.

– Chris Turner
Nov 21 '18 at 13:55













I understand and that is the main reason of this question, it just acts strangely. This is the output I get. Programming 3 5 3 4 2 Mathematics 3 4 3 2 Physics 3 5 4 Design 5 5 2 Logistics 3 5 1 2

– Aleksandre Sikharulidze
Nov 21 '18 at 14:01







I understand and that is the main reason of this question, it just acts strangely. This is the output I get. Programming 3 5 3 4 2 Mathematics 3 4 3 2 Physics 3 5 4 Design 5 5 2 Logistics 3 5 1 2

– Aleksandre Sikharulidze
Nov 21 '18 at 14:01






1




1





If that's the output you're getting, then you're not running the code included in the question, with or without my changes. If I run that code I get just "Programming Mathematics Physics Design Logistics"

– Chris Turner
Nov 21 '18 at 14:25





If that's the output you're getting, then you're not running the code included in the question, with or without my changes. If I run that code I get just "Programming Mathematics Physics Design Logistics"

– Chris Turner
Nov 21 '18 at 14:25




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412774%2fc-larger-output-than-i-have-in-file-size-problem%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?