Question

hi can you please use simple c++, and write with using "Arrays" and include "ctype.h, string,iostream" and use "while" "||&& operators" "for" "if" statements, Function Return Type Description Return size size size t max_size size t Return maximum size (always match with size) Test wh,this should be written in c++101, thanksAssessmentz- Simple Application Scenario 4: Temperature record Write a program that takes a maximum and minimum temperature o

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

NOTE: Please upvote if you find this solution useful in any way.

For any doubts or queries, use the comment section below.

CODE:

#include<stdio.h>
#include<ctype.h>
#include<iostream>

using namespace std;

//function to find minimum temperature
float min_temperature(float a[7]){
   float num;
   num = a[0];
   int i=1;
   while(i<7){
       if(a[i] < num)
           num = a[i];
       i += 1;
   }
   return num;
}

//function to find maximum temperature
float max_temperature(float a[7]){
   float num;
   num = a[0];
   int i=1;
   while(i<7){
       if(a[i] > num)
           num = a[i];
       i += 1;
   }
   return num;
}

//function to find average temperature
float avg_temperature(float a[7], float b[7]){
   float avg;
   int i=0;
   while(i<7){
       avg += a[i] + b[i];
       i += 1;
   }
   return avg/14;
}

//function to find size of array
int size(float a[]){
   return a.size();
}

//function to check whether array is empty or not
bool empty(float a[]){
   return true;
}

//function to fill the array with elements
void fill(float a[]){
}

//function to swap array value with x
void swap(float a[], int x){
}

//main function
int main(){
   float a1[7],a2[7];
   cout << "Please enter this week temperatur,\nMonday: ";
   cin >> a1[0] >> a2[0];
   cout << "Tuesday: ";
   cin >> a1[1] >> a2[1];
   cout << "Wednesday: ";
   cin >> a1[2] >> a2[2];
   cout << "Thursday: ";
   cin >> a1[3] >> a2[3];
   cout << "Friday: ";
   cin >> a1[4] >> a2[4];
   cout << "Saturday: ";
   cin >> a1[5] >> a2[5];
   cout << "Sunday: ";
   cin >> a1[6] >> a2[6];

   cout << "\nThis week,\n";
   cout << "\tminimum temperature is: " << min_temperature(a2);
   cout << "\n\tmaximum temperature is: " << max_temperature(a1);
   cout << "\n\taverage temperature is: " << avg_temperature(a1,a2);
   cout << "\n";
   return 0;
}
Screenshots:

nclude ctype.h us Lag nanespace std function te ind rinnun texperature return nun runction to find raxion tenperature Float nreturn sg 14 runction to ind size ot array int stzefloat -size( ) ; return return true; //runction to ↑111 the rray with eloFri 16-37 itunction to f the srray with elenents /function to sap array value ith x in rloat ai17],2171: rout Please nter th2 Terminal Open nclude ctype.h us Lag nanespace std flast -in-terpersture( float Float n 817] lease enter this week texperatu

If you want to add or remove any function, mention it in the comment section below.

Add a comment
Know the answer?
Add Answer to:
hi can you please use simple c++, and write with using "Arrays" and include "ctype.h, string,iostream" a...
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++ Only. Don't use other libraries other than #include <iostream> and using namespace std; Write a...

    C++ Only. Don't use other libraries other than #include <iostream> and using namespace std; Write a function maxTemp which takes a filename as string argument and returns the maximum temperature as float type for the week. Input file will contain temperature readings for each day of the week. Your function should read each line from the given filename, parse and process the data, and return the required information. Your function should return the highest temperature for the whole week. Empty...

  • HI USING C++ CAN YOU PLEASE PROGRAM THIS ASSIGNMENT AND ADD COMMENTS: stackARRAY: #include<iostream> #define SIZE...

    HI USING C++ CAN YOU PLEASE PROGRAM THIS ASSIGNMENT AND ADD COMMENTS: stackARRAY: #include<iostream> #define SIZE 100 #define NO_ELEMENT -999999 using namespace std; class Stack { int arr[SIZE]; // array to store Stack elements int top; public: Stack() { top = -1; } void push(int); // push an element into Stack int pop(); // pop the top element from Stack int topElement(); // get the top element void display(); // display Stack elements from top to bottom }; void Stack...

  • USING THE C++ CODE BELOW, CAN YOU PLEASE SOLVE THE QUESTION AND EXPLAIN THE STEPS. class...

    USING THE C++ CODE BELOW, CAN YOU PLEASE SOLVE THE QUESTION AND EXPLAIN THE STEPS. class StaticStack { private: int *stack; int capacity; int top; // index of the top element public: StaticStack(int size); // constructor ~StaticStack(); bool isFull(); bool isEmpty(); void push(int); int pop(); }; #include "StaticStack.h" #include <iostream> using namespace std; StaticStack::StaticStack(int size) { stack = new int[size]; // constructing a size sized array capacity = size; top = -1; // empty stack    } StaticStack::~StaticStack() { delete...

  • Please Write the following program in c# You are to write an application which will create...

    Please Write the following program in c# You are to write an application which will create a company, add agents (their name, ID, and weekly sales) to that company, and printout the details of all agents in the company. The application will contain three classes: Agent.cs, Company.cs, and CompanyTest.cs (this class is already provided). Flow of the application: The CompanyTest class creates an object of the Company class and reserves space for five agents. At this point if you call...

  • Use the C programming language to complete #include <stdio.h> #include <stdlib.h> #include <float.h> // Declare Global...

    Use the C programming language to complete #include <stdio.h> #include <stdlib.h> #include <float.h> // Declare Global variables here. void array_stats() { // Insert your solution here. } #include <stdlib.h> #include <time.h> int main() { // Simulate the test setup process. srand( time( NULL ) ); for ( int i = 0; i < 32; i++ ) { val[i] = rand(); } val_count = rand(); val_mean = rand(); val_min = rand(); val_max = rand(); // Call submitted code. array_stats(); // Display...

  • Hi, it's C++ question. Only can use <iostream> and <fstream>libraries Please help me, thanks Question Description:...

    Hi, it's C++ question. Only can use <iostream> and <fstream>libraries Please help me, thanks Question Description: For this project you will write a program to: a) read-in the 10 first names from a file (the file is a priori given to have exactly 10 entries, of a maximum length of 8 letters each) into a 2-dimensional character array, b) output the names to the terminal with each one preceded by a number indicating its original order in the list, c)...

  • 10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated...

    10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...

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