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
What are the six command groups in powerpoint
DiKsa [7]

Answer:

Clipboard, Slides, Font, Paragraph, Drawing, and Editing

3 0
3 years ago
You develop an app, and you don’t want anyone to resell it or modify it. This is an example of: A
Maru [420]

Answer:

C, proprietary software

Explanation:

Proprietary software, also known as non-free software, is computer software for which the software's publisher or another person reserves some rights from licensees to use, modify, share modifications, or share the software. It sometimes includes patent rights.

7 0
3 years ago
Edhesive assignment 7 calendar
ikadub [295]

Answer:

def leap_year(y):

 if y % 4 == 0:

     return 1

 else:

     return 0

def number_of_days(m,y):

 if m == 2:

     return 28 + leap_year(y)

 elif m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m ==10 or m == 12:

     return 31

 elif m == 4 or m == 6 or m == 9 or m == 11:

     return 30

def days(m,d):

 if m == 1:

     return 0 + d

 if m == 2:

     return 31 + d

 if m == 3:

     return 59 + d

 if m == 4:

     return 90 + d

 if m == 5:

     return 120 + d

 if m == 6:

     return 151 + d

 if m == 7:

     return 181 + d

 if m == 8:

     return 212 + d

 if m == 9:

     return 243 + d

 if m == 10:

     return 273 + d

 if m == 11:

     return 304 + d

 if m == 12:

     return 334 + d

def days_left(d,m,y):

 if days(m,d) <= 60:

     return 365 - days(m,d) + leap_year(y)

 else:

     return 365 - days(m,d)

print("Please enter a date")

day=int(input("Day: "))

month=int(input("Month: "))

year=int(input("Year: "))

choice=int(input("Menu:\n1) Calculate the number of days in the given month.\n2) Calculate the number of days left in the given year.\n"))

if choice == 1:

 print(number_of_days(month, year))

if choice == 2:

 print(days_left(day,month,year))

Explanation:

Hoped this helped

5 0
2 years ago
Differentiate between soft copy output and hard copy output?​
katen-ka-za [31]

a hard copy stores data and information in the form of physical files it may be images text photographs and more a soft copy data and information in the form of virtual file saved on a computer or a drive you can preserve a hard copy for two long because its day subjected to wear and tear

4 0
2 years ago
Read 2 more answers
1. It is a set of integrated devices that input, output,
grin007 [14]

Answer:

A

Explanation:

Program system and software canot pulg in

4 0
2 years ago
Other questions:
  • Which of the following is an important initial step in designing an interface
    7·1 answer
  • Identifying what you will need to review takes place during?
    8·2 answers
  • The benefits associated with AAA are increased security, increased control over the network, and the capability of auditing your
    12·1 answer
  • Analyze the following code. // Program 1: public class Test { public static void main(String[] args) { Object a1 = new A(); Obje
    5·1 answer
  • Describe how implementation of a raid level 2 system would be beneficial to a university payroll system
    12·1 answer
  • How can you enter Task Manager in Windows? Select 3 options. press Ctrl + Shift + Tab press Ctrl+Alt+Delete and then click Task
    8·1 answer
  • Items that are cut or copied are placed on the Clipboard.
    6·2 answers
  • Can someone tell me how to fix the keyboard on ipad?- its in the middle of my screen andd i dont know how to do it
    13·1 answer
  • Cho 3 lớp như hình, viếtchương trình thực hiện các chức năng sau:
    15·1 answer
  • The BaseballPlayer class stores the number of hits and the number of at-bats a player has. You will complete this class by writi
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!