Question

In: Computer Science

In 2 to 3 paragraphs describe the C program written below (What the program is supposed...

In 2 to 3 paragraphs describe the C program written below (What the program is supposed to do). State the requirements for the program (How does the program meet the requirements) and discuss the logical process your program uses to meet those requirements (The process steps to meet the requirements).

#include "stdio.h"

int main(void)

{

//initialize array
int arr[100];

  //initialize variables
  int i=0, j=0, n=0;

   //infinite loop which will stop when user enters -1
  while(n != -1)

{
  

printf("Enter percentage grade(0-100). Enter -1 to stop: ");

//read grade
  scanf("%d",&n);

  //if user entered grade is not -1
if(n != -1)
{
//save it to array
arr[i++] = n;
  
}
//if user entered -1, then exit this loop
else
{

break;

}  
  
}
  
  
printf("\n\nThe grades are: \n");

//loop which will iterate till no:of user entered grades
for(j=0; j<i; j++)

{
  //print the grade
  printf("%d ",arr[j]);

}
  
return 0;

}

Solutions

Expert Solution


Related Solutions

The c++ program is supposed to store the txt into a stack depending on the what...
The c++ program is supposed to store the txt into a stack depending on the what the random number generator assigns each student and stores them into the stack. But it keeps giving me the same outputs and I can't figure out why? #include<iostream> #include<fstream> #include<string> #include<sstream> #include<stack> using namespace std; struct student { int ID; string last_name; double gpa; }; void read_std_file(student* std); void store_std_into_stack(stack <student> ss, student std[]); void wite_output_file(student std); void read_std_file(student* std) { ifstream file; file.open("C://temp//students.txt");...
I'm supposed to create a c++ program which is supposed to take a sentence as an...
I'm supposed to create a c++ program which is supposed to take a sentence as an input and then output a sorted list of the occurrence of each letter. ex. Enter a phrase: It's a hard knock life A2 I2 K2 C1 D1 E1 F1 H1 L1 N1 O1 R1 S1 T1 I was also given a recommended code to use as a bubble sort procedure bubbleSort( A : list of sortable items ) n = length(A) repeat swapped =...
. Written presentations should be a minimum of 2-3 paragraphs per each diagnosed condition (3 conditions...
. Written presentations should be a minimum of 2-3 paragraphs per each diagnosed condition (3 conditions minimum). Symptom Presentation: Adrenalin: Increased epinephrine (catecholamine production) from the adrenal medulla Heart Rate: Increased resting heart rate with intermittent bursts of arrhythmia Blood Pressure: Systemic hypertension reported over the past 8 months Hypertensive Retinopathy: arteriolar constriction, vascular wall changes, cotton-wool spots, yellow hard exudates, and optic disk edema Previously, you researched and considered three conditions through the process of differential diagnosis that would...
1. Describe the origin of exponents in 2-3 paragraphs (please cite)
1. Describe the origin of exponents in 2-3 paragraphs (please cite)
Write 3 paragraphs (5-7 sentences) describe: 1.What Ocean Acidification is and what causes it 2. What...
Write 3 paragraphs (5-7 sentences) describe: 1.What Ocean Acidification is and what causes it 2. What are the affects of acidification to the ocean environment and marine life. 3. What does NOAA stand for and what do they do?
A program written in C that asks for the distance to be entered and then prints...
A program written in C that asks for the distance to be entered and then prints the fare A transportation company has the following rates For the first 100 miles                                                       20 cents a mile For the next 100 miles                                                       a) + 10 cents per mile over 100 miles For the next 100 miles                                                       b) + 8 cents per mile over 200 miles more than 300 miles                                                          c) + 5 cents per mile over 300 miles Write a program that asks...
(Written in C)The input below shows a grid dimension (first line), the following 2 are the...
(Written in C)The input below shows a grid dimension (first line), the following 2 are the positions of the start cell and end cell, and the rest is the positions of cells blocked. Keep in mind that the input is an txt file to be read through stdin (you can not type input multiple times). How do I read the input using scanf . Also, it is not allow to store input into array (because we can not assume the...
q7.4 Fix the errors in the code (in C) //This program is supposed to scan 5...
q7.4 Fix the errors in the code (in C) //This program is supposed to scan 5 ints from the user //Using those 5 ints, it should construct a linked list of 5 elements //Then it prints the elements of the list using the PrintList function #include <stdio.h> struct Node{ int data; Node* next; }; int main(void){ struct Node first = {0, 0}; struct Node* second = {0, 0}; Node third = {0, 0}; struct Node fourth = {0, 0}; struct...
You may use either written paragraph or bullet-point format. Part 1 should be 2–3 paragraphs in...
You may use either written paragraph or bullet-point format. Part 1 should be 2–3 paragraphs in length or an equivalent amount of content in bullet-point form. Part 1: Pricing Strategy Briefly describe pricing for your product or service. How does this compare to competitors, assuming competitors are at or near break-even point with their pricing? Analyze pricing alternatives and make recommendations about pricing going forward based on the following: How sensitive are your customers to changes in price? What revenue...
Marketing and Advertising. 2 to 3 paragraphs long List and describe the three different variables that...
Marketing and Advertising. 2 to 3 paragraphs long List and describe the three different variables that you feel contribute to overall ad effectiveness. List three different variables that you feel take away the effectiveness of ads.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT