Free help with homework

Why join Brainly?

  • ask questions about your assignment
  • get answers with explanations
  • find similar questions

Write a C program that takes two integer arrays A and B from a text file.The arrays may have different lengths.Determine the values in array A and array

B.Next,write a function that print the average values in ascending order on the screen.


Void read_ints (const char* file_name)

FILE* file = fopen (file_name, "r"); 
 int i = 0;
  fscanf (file, "%d", &i);     
while (!feof (file)) 
  printf ("%d ", i);     
 fscanf (file, "%d", &i);    
  fclose (file);    
int c;
FILE *file;file = fopen("test.txt", "r");
if (file) {   
 while ((c = getc(file)) != EOF)     

this is sample to take integer from text file...

#include <iostream>
#include <conio.h> 
void main ()
int array [3], t;
for (int  x=0; x<3; x++)

   cout << "Enter integer number" << x+1 << " : " << endl; 
   cin<< array[x];
for (x=0; x<3; x++)
for (int y=0; y<2; y++)

cout << "The integers in ascending order are :
 ";for (x=0;x<3;x++)
cout << endl << array[x];
this for 
ascending order
1 5 1
The Brain
  • The Brain
  • Helper
Not sure about the answer?
Learn more with Brainly!
Having trouble with your homework?
Get free help!
  • 80% of questions are answered in under 10 minutes
  • Answers come with explanations, so that you can learn
  • Answer quality is ensured by our experts