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]
3 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]3 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
Once you've connected to a data source, which button would you select to add a first name to your form letter?
Vesnalui [34]

Selecting the Address Block to add a first name to your form letter.

4 0
3 years ago
Read 2 more answers
Which of the following terms describes a product that is designed to meet humans’ physical and/or psychological needs?
Readme [11.4K]
I think it is psychological needs
8 0
3 years ago
Read 2 more answers
Add a function named circle to the polygons module. This function expects the same arguments as the square and hexagon functions
PolarNik [594]

Answer and Explanation:

import Circle

#include<conio.h>

void main ()

int t , length , n

//for hexagon

def hexagon(t, length, n):

 for _ in range(n):

 t.fd(length)

t.lt(360 / n)

square = Circle.Circle()

square.penup()

square.sety(-270)

square.pendown()

hexagon(square, 30, 60)

5 0
3 years ago
What would best describe the future of cybersecurity?
Andrei [34K]

The best describe the future of cybersecurity is strong security policies offer little protection.

<h3>What is cybersecurity?</h3>

Cybersecurity is the security of data or computer systems. Cybersecurity is provided from the hackers that hacks the data and money online.

As everything is converting digital, the need of cybersecurity is increasing.

Thus, the correct option is B.

Learn more about cybersecurity

brainly.com/question/27560386

#SPJ1

5 0
2 years ago
8. Compare the advantages and disadvantages of using a smartphone rather than a laptop computer for creating a report.​
JulijaS [17]

Answer: the advantage of using a smartphone rather than a laptop computer is that you can talk to people across the world, call people, make texts, and get easy access to the internet. but the disadvantages are that a lot of people stay inside their house because of phones, not getting enough exercise.

Explanation:

3 0
3 years ago
Other questions:
  • Why we can't install a 64 bit software on a 32 bit computer??
    5·1 answer
  • A network admin configures a static route on the edge router of a network to assign a gateway of last resort (the router that co
    9·1 answer
  • • Describe the steps in detail that the operating system performs to handle interrupts, including ISRs, the stack, and hardware?
    5·1 answer
  • What do you use for soaking hands and holding soapy water​
    7·2 answers
  • What is a prototype ?
    9·1 answer
  • a deque is a type of collection,but it is not automatically available when you open IDLE. What is missing that allows you to use
    14·2 answers
  • Which of the following is referred to as "keeping up with the Joneses"?
    13·1 answer
  • Explains why do we use formulas instead of just using a calculator in Excel?​
    7·1 answer
  • Help please answer the question 1 2 3 4 5 6<br><br>help
    12·1 answer
  • Which of the following was the first computer-animated film to win animated film to win an academy award?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!