1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Allisa [31]
2 years ago
8

Write a program which populates an array with integer values read from a file. We do not know how many integers are in the file,

so you must loop until the end of the file is reached. For this problem, you may NOT use the function feof(). Instead, use the result returned from fscanf() to determine the end-of-file. Recall, we can set the result of fscanf() to an integer variable, and check to see if the integer variable is equal to the EOF marker. The program must take the items in the array and reverse them. You may use one array only to solve this problem.
Computers and Technology
1 answer:
max2010maxim [7]2 years ago
5 0

Answer:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

int main()

{

int arr[100];

int i = 0;

int j = 0;

char c[10];

char temp;

int sum = 0;

FILE* fp;

if ((fp = fopen("test.txt", "r")) == NULL) {

printf("cannot open the file");

return;

}

else {

do {

temp = fgetc(fp);

if (temp == ' ' || temp == '\n') {

c[j] = '\0';

arr[i++] = atoi(c);

j = 0;

continue;

}

c[j++] = temp;

} while (temp != EOF);

for (j = i - 1; j >= 0; j--) {

printf("%d\n", arr[j]);

}

}

getchar();

}

Explanation:

You might be interested in
1. Which of the following is NOT an example of systems software? (Points : 1)
vladimir2022 [97]
The answer is "operating systems" brcause you need that that to use the rest
' 
4 0
2 years ago
Read 2 more answers
Which of these is one of the primary concerns for protecting your family when online?
Lady_Fox [76]
Sharing personal information
7 0
2 years ago
Read 2 more answers
Jerome falls sick after eating a burger at a restaurant. After a visit to the doctor, he finds out he has a foodborne illness. O
babunello [35]

Answer: food poisning

Explanation:

either the food wasnt

cooked properly or the food was out of date and went bad

3 0
3 years ago
________ is a mobile broadband technology that relies on microwave transmissions to blanket large metropolitan areas from microw
FinnZ [79.3K]

Answer:

WiMax

Explanation:

Wimax is a family standards of a communication of bandwidth, this is a standard IEEE 802.16, was created to provide data velocity like 30 or 40 megabits per seconds, but in 2011 was updated, and now can provide 1 gigabit per second, the name WiMAX is for a forum created in 2001 to promote the standard.

4 0
3 years ago
When using a line graph, why is it inportant to only graph 1 - 3 series of data?. A. A line graph in Microsoft Excel will not al
ElenaW [278]
The most necessary point you need to follow when using a line graph, is to make your graph readable. So, the reason why is it inportant to only graph 1 - 3 series of data is that more than 3 series of data causes too many lines on the graph, which makes ti confusing to read. The last option is the correct one.
8 0
2 years ago
Other questions:
  • Read each statement below. If the statement describes a peer-to-peer network, put a P next to it. If the statement describes a s
    13·2 answers
  • When a speaker is finished talking, you should allow for _____.
    14·2 answers
  • Choose the reasons why Windows Server operating systems are a popular choice for a network because they _____. Select all that a
    12·1 answer
  • Write a program in which given an integer num, return the sum of the multiples of num between 1 and 100. For example, if num is
    7·1 answer
  • Please help I really need it
    7·1 answer
  • You would like to put the data in order by product number. What should you do?
    15·1 answer
  • What happens when a computer gets a virus?
    6·2 answers
  • JAVA
    12·1 answer
  • Which term describes a visual object such as a picture, a table, or a text box?
    14·2 answers
  • The Baltimore Sun reported on a study by Dr. Sara Harkness in which she compared the sleep patterns of 6-month-old infants in th
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!