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
Wide area network (WAN) connects multiple networks that are in the same geographical locations.
xeze [42]

Answer:

False.

Explanation:

<em>This is pertaining to LAN or Local Area Network. LAN is a type of network that is consist of one or several networks located in one geographical area or location. Wherein WAN or Wide Area Network is a type of network that is located in different or several geographical area. The basic example of WAN is the Internet. Networks of computers are connected even though they are not wired physically.</em>

5 0
3 years ago
What what do these two parts of the lift do ​
Dmitry [639]

Answer:

which parts are you talking about

7 0
3 years ago
Give an example of a situation in which a compromise of Confidentiality leads to compromise in Integrity.Situation where confide
il63 [147K]

Answer: An example of such a scenario would be when the user name and password meant to allow access to a customers bank account statement is cracked by unauthorized people this causing alteration (in the form of data diddling attacks) in the data contained in the statement. This is a compromise in integrity.

Explanation:

Confidentiality entails securing things people want to remain secret. An account statement of a bank customer is a confidential document which is to be kept secret. A password allows access to it.

Integrity implies receiving a sent data/information as accurately as it came from a sender. A data diddling attack alter integrity because the original information is altered by an unauthorized person.

7 0
3 years ago
Codio Challenge Activity PythonWe are passing in a list of numbers. You need to create 2 new lists in your chart, then put all o
lilavasa [31]

Answer:

The python code is given below with lists defined.

Explanation:

import sys

def isEven(n) :

 return ((n % 2) == 0)  //for even items

numbers = sys.argv[1].split(',')

for i in range(0,len(numbers)):

 numbers[i]= int(numbers[i])

even = []

odd = []

for i in numbers:

   if isEven(i):

       even.append(i)  #adds i to even list if it is even

   else:

       odd.append(i)  #adds i to odd list if not even (odd)

print(odd)

print(even)

7 0
3 years ago
____ are designed to be used with everyday objects, such as home appliances, gaming consoles, digital cameras, e-readers, digita
Fudgin [204]

Embedded Operating Systems are designed to be used with everyday objects, such as home appliances, gaming consoles, digital cameras, e-readers, digital photo frames, ATMs, toys, watches, GPS systems, home medical devices, voting terminals, and cars.

6 0
3 years ago
Other questions:
  • The eastern front was longer than other fronts of the war true or false
    7·2 answers
  • MTTF is a file format developed by Microsoft commonly used on Windows systems; it offers file security, large volume size, large
    11·1 answer
  • #Write a function called string_finder. string_finder should #take two parameters: a target string and a search string. #The fun
    14·1 answer
  • Every time you are asked to work with others, you are being asked to:
    6·2 answers
  • Encryption Using Rotate Operations Write a procedure that performs simple encryption by rotating each plaintext byte a varying n
    10·1 answer
  • Translate each statement into a logical expression. Then negate the expression by adding a negation operation to the beginning o
    15·1 answer
  • D) Informal high level descuption of an algorithm in english kcalled
    9·2 answers
  • What is the result of executing the following code? You can assume the code compiles and runs. #include using namespace std; voi
    6·1 answer
  • Gabriel's sister called him about a message that suddenly appeared on her screen that says her software license has expired and
    11·1 answer
  • If an occupation is projected to decline by 7% over the next 10 years, how would you rate the job outlook? (6 points)
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!