Question

c++O fe/C/Users/Younis/App ft.Microsoftedgc b17%20(1)pdf 1 of 1 CSC 2000 C+t Programming Language Winter Term 2019 Lab 17 10 poi

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;


int c1,c2,c3,c4,c5;
void fun(int a[3][5]);

void fun(int a[3][5])
{

c1=0;
c2=0;
c3=0;
c4=0;
c5=0;


cout<<" hgg";

for(int i=0;i<3;i++)
{

for(int j=0;j<5;j++)
{
// count the valuse
if(a[i][j]<60)
c1++;
else if(a[i][j]>=60 && a[i][j]<70)
c2++;
else if(a[i][j]>=70 && a[i][j]<80)
c3++;
else if(a[i][j]>=80 && a[i][j]<90)
c4++;
else if(a[i][j]>=90)
c5++;


}
}

}
int main()
{

int array[3][5]; // array
cout<<"Enter a voltage : ";


// reading values
for(int i=0;i<3;i++)
{

for(int j=0;j<5;j++)
{

cin>>array[i][j];


}

}

fun(array);
// printing valuse

cout<<"There are "<<c1<<" voltages less than 60"<<endl;
cout<<"There are "<<c2<<" voltages between 60 and 70 "<<endl;
cout<<"There are "<<c3<<" voltages between 70 and 80 "<<endl;
cout<<"There are "<<c4<<" voltages between 80 and 90 "<<endl;
cout<<"There are "<<c5<<" voltages greater than or equal to 90"<<endl;


}

椥neggarr.cpp-Code:Blocks 10 05 File Edit View Search Project Build Debug woSmith Tools Plugins Settings Help main) : int Proj

Add a comment
Know the answer?
Add Answer to:
c++ O fe/C/Users/Younis/App ft.Microsoftedgc b17%20(1)pdf 1 of 1 CSC 2000 C+t Programming Language Winter Term 2019...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ U CHU PO J O ! Week 11 Homework-Functions X + /bbcswebdav/pid-2592362-dt-content-rid-39864984_1/courses/CSC-170-03-191/CSC%20170%20Program%205%20%26% CSC 170 -...

    c++ U CHU PO J O ! Week 11 Homework-Functions X + /bbcswebdav/pid-2592362-dt-content-rid-39864984_1/courses/CSC-170-03-191/CSC%20170%20Program%205%20%26% CSC 170 - 03 Fall 2019 Program 5 & 6 You are required to write a program which reads five test scores and computes and prints the sum and average of these test scores. Note: This program should not use arrays. You are required to produce two versions of this program Version 1 Program 5 In the first version you must use the following: 1. Avoid function...

  • In C programming Write a program that displays the appropriate prompt to input 5 scores. Once...

    In C programming Write a program that displays the appropriate prompt to input 5 scores. Once the user inputs the five integer values, your program calculates and prints the average. You do not need to declare five different variables, think of how you can get away with a single variable. The second part of this program will print A if the average of these 5 numbers is greater than or equal to 90 but less than 100, B if greater...

  • using C geany. Please Dr. exercise # 1 and 2 During the lab: PART I: PROGRAMMING...

    using C geany. Please Dr. exercise # 1 and 2 During the lab: PART I: PROGRAMMING EXERCISES a. Using Geany, write a C program that prompts and asks the user for two assignment marks (al and a2) and two test marks (ti and t2). All four variables are integer variables and are in % (out of 100). You program should display the four marks properly lalebed to check if the input has been successful. b. Next, calculate and display the...

  • (Statistics) a. Write a C++ program that reads a list of double-precision scores from the keyboard...

    (Statistics) a. Write a C++ program that reads a list of double-precision scores from the keyboard into an array named scores. It is assumed that the user will enter no more than 35 scores. The scores are to be counted as they're read, and entry is to be terminated when a negative value has been entered. After all scores have been input, your program should find and display the sum and average of the scores. The scores should then be...

  • i need help getting this program running Pearson Sign in Mail - Josue Velazq... CSC 15...

    i need help getting this program running Pearson Sign in Mail - Josue Velazq... CSC 15 Chapter 4 lab This lab has two different problems. In this lab you are going to provide different options for the user to choose from Your program must provide the exact same output provided including "a" or "an". Requirements: You must use good style: meaningful variable names and good, consistent indentation All the I/O input/output) must be done in the run method. In addition...

  • C++ 1. Write a program to check if two values are equal. The output should give...

    C++ 1. Write a program to check if two values are equal. The output should give the response "Both a and b are the same" or "a and b are not the same". 2. Write a program to take a test score and determine the grade A is 90-100, B is 80-89, C is 70-79, D is 60-69, F is 60 or below. BONUS - check for input validation (score over 100 or under 0)

  • Write a C++ program that computes student grades for an assignment as a percentage given each...

    Write a C++ program that computes student grades for an assignment as a percentage given each student's score and the total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath header file and displayed as a percentage. You must also display the floating-point result up to 5 decimal places. You must use at least 2 functions: one to print the last name of the student and another function to...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

  • (1 point) nin nax D1 28 Min ax D2 42 72 nin Max D3 82 20 30 48 50 60 70 80 90 180 Which of the fo...

    (1 point) nin nax D1 28 Min ax D2 42 72 nin Max D3 82 20 30 48 50 60 70 80 90 180 Which of the following are true? A. The data in D3 is skewed right B. The median value for D1 is less than the median value for D3 C. At least a quarter of the data values in D2 are less than all of the data values in D3 D. At least a quarter of the...

  • english 4. Design a for loop that would add all the odd numbers starting from 1...

    english 4. Design a for loop that would add all the odd numbers starting from 1 to 1001 and store in the variable sum (10 points) 5. [Programming Exercise) (20 POINTS) Write a Program that will use a function named Grade which will take three inputs: homeworks, midterm and final and compute average using 20% of homeworks, 30% from midterm and 50% from final. Then it will compute the letter Grade by using the following: If the average is greater...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT