Jump to content

help ASAP pls...

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
mdeenny

mdeenny

    Newbie

  • Members
  • Pip
  • 4 posts
got this question...

Once the user exits, the system will write the student array in ascending order in a file called ascending.txt together with the graph.

so i do this for the graph...


...
void fta(int);
void ftb(int);
void ftc(int);
void ftd(int);


void main (void)


{
int a=0;
int b=0;
int c=0;
int d=0;

		for(x=0;x<size;x++)
	{
		if(std[x].avrg>80)
			a=a+1;
		else if(std[x].avrg>60)
			b=b+1;	
		else if(std[x].avrg>40)
			c=c+1;
		else
			d=d+1;
	}	
				printf("\n");
		printf("\tGrade A:%d",a);	printf("\n");
		printf("\tGrade B:%d",b);	printf("\n");	
		printf("\tGrade C:%d",c);	printf("\n");		
		printf("\tGrade D:%d",d);	printf("\n");	


		
		printf("\n");printf("\n");
	printf("\tA:");fta(a);printf("\n");
	printf("\tB:");fta(b);printf("\n");
	printf("\tC:");fta(c);printf("\n");
	printf("\tD:");fta(d);printf("\n");

}




void fta(int a)
{
int x;
	for(x=0;x<a;x++)
		printf("#");

}



void ftb(int b)
{
int x;
	for(x=0;x<b;x++)
		printf("#");

}



void ftc(int c)
{
int x;
	for(x=0;x<c;x++)
		printf("#");

}



void ftd(int d)
{
int x;
	for(x=0;x<d;x++)
		printf("#");

}


the problem is, i need to send this graph into a note file...
how,how,how...

and, also need help regarding the "array in ascending order"... example maybe...:confused:

Edited by John, 29 October 2009 - 10:19 AM.
Use [CODE] tags when posting code.


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
ascending order: sorted (probably by name).

Print the graph to file instead of output.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
Lookup qsort for an easy way to sort the array. As to writing the array to a file, also learn to google. Hundreds of thousands of existing posts and tutorials.