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
neonofarm [45]
3 years ago
8

During a drawing competition, the review system is implemented by assigning 3 to 5 reviewers per submission. Each drawing is ran

ked by 3 to 5 reviewers on a continuous scale of 1 to 5 (1 being the lowest score and 5 being the highest, decimal numbers are not allowed).
Final results are saved in the reviews file (given separately). (Format of each line: author_name,score_1score_2............score_5)
James, 24152
Ann, 145
Thomas 5345
Mark,432
Karen, 222
Write a C program to read, process, and output data as explained:
1. Read and process the content of the reviews text file.
2. Calculate the average score per contestant. (average = sum of all the scores / number of scores)
3. Display results in a formatted chart. For each contestant, list the name and the 3 to 5 scores followed by the average score.
Comments are not required, define functions where necessary.
Name S1 S2 S3 S4 S5 Ave
James 2 4 1 5 2 2.8
Ann 1 4 5 3.33
Thomas 5 3 4 5 4.25
Mark 4 3 2 3
Karen 2 2 2 2
James, 24152
Ann, 145
Thomas, 5345
Mark, 432
Karen, 222
Computers and Technology
1 answer:
lisabon 2012 [21]3 years ago
4 0

Answer:

See explaination

Explanation:

//include <stdio.h>

#include <stdlib.h> // For exit()

#include <stdbool.h>

int main()

{

FILE *fptr;

char filename[100], c;

// Open file

fptr = fopen("review.txt", "r");

if (fptr == NULL)

{

printf("Cannot open file \n");

exit(0);

}

// Read contents from file

c = fgetc(fptr);

printf("Name S1 S2 S3 S4 S5 Ave\n");

bool flag = false;

int sum = 0;

int count = 0;

while (c != EOF)

{

if(c == '\n'){

printf ("%f ", (double)sum/count);

count = 0;

sum = 0;

flag = false;

}

if(c != ',')

{

if(flag){

printf ("%c ", c);

sum = sum + (int)(c)-48;

count++;

}

else

printf("%c", c);

}

if(c == ',')

{

flag = true;

printf(" ");

}

c = fgetc(fptr);

}

printf ("%d ", sum/count);

fclose(fptr);

return 0;

}

You might be interested in
Write a program that inputs a line of text and uses a stack object to print the line reversed.
Lina20 [59]

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

   string ms;

   getline(cin,ms);

   stack<char>st;

   for(int i=0;i<ms.length();i++)//Inserting every element in the stack..

   {

       st.push(ms[i]);

   }

   while(!st.empty()) //doing operation until the stack is not empty..

   {

       char a=st.top();//accessing the top element of the stack...

       st.pop();//removing the head.

       cout<<a;//printing the character..

   }

return 0;

}

Input:-

murder

Ouput:-

redrum

Explanation:

An  easy way to reverse anything is to use stack.Since stack is LIFO type data structure so the last item in will be the first one to get out hence it reverses the elements.So inserting every element of the string into the stack of characters and then printing the every element of the stack from top to bottom.

8 0
3 years ago
If you delete a shortcut from your desktop, have you also deleted the original file?
svet-max [94.6K]

Answer:

no

Explanation:

it just deletes the icon.

4 0
3 years ago
Read 2 more answers
Clickable text or image that takes you to a different site
hichkok12 [17]
A clickable text or image that takes you to a different site is called a Hyperlink or simply a Link.
3 0
3 years ago
Which two features could be added to a game using an "if () then " block
mafiozo [28]

The two features could be added to a game using an "if () then " block are:

  • Using nested If Then blocks.
  • Checks the specific Bid quantity for the instrument.

<h3>What does the If Then block mean?</h3>

The If Then block is known to be the outputs one of  a given two values, that is as a result of  the value of a Boolean input.

Note that  the input value  is very important and as such, The two features could be added to a game using an "if () then " block are:

  • Using nested If Then blocks.
  • Checks the specific Bid quantity for the instrument.

Learn more about game  from

brainly.com/question/1786465

#SPJ1

3 0
2 years ago
Compare and contrast CD and DVD?
anzhelika [568]

Answer:

Both Flat, round discs.

A DVD can hold six times as much as compacity than a disc.

A CD is a Compact Disc.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Blender questions
    8·1 answer
  • The part of the computer that provides access to the internet is the?
    14·1 answer
  • Smart art can be used to create _____that highlights relationships betweeen two items
    8·2 answers
  • Fortnite anyone? i just started tdy so dont be judgiee lol
    6·2 answers
  • When network cards are communicating, bits can occasionally be corrupted in transmission?
    5·1 answer
  • Write a computer program that computes the duration of a projectile’s flight and its height above the ground when it reaches the
    11·1 answer
  • .... . .-.. .-.. --- .-.-.-<br><br><br> TRANSLATE THAT.
    10·1 answer
  • Is there any difference beetween the old version of spyro released on the origional and the newer ones??? or is it only change i
    8·1 answer
  • In 3-5 sentences describe to me in detail how you can make a change and better our online community. What are steps would you ta
    8·2 answers
  • Can someone give me an earsketch song of summer to turn in
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!