Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need it in C++ 27.15 Loops*: Biggest difference Write a program that outputs the biggest difference (absolute value) between any successive pair of numbers in

Need it in C++
image text in transcribed
27.15 Loops*: Biggest difference Write a program that outputs the biggest difference (absolute value) between any successive pair of numbers in a list Such a list might represent daily stock market prices or daily temperatures, so the difference represents the biggest single-day change. The input is the list size, followed by the numbers. iIf the input is 5 60 63 68 61 59, the output is 7 HINTS Declare a variable for the current number, and another for the previous number. At the start of each loop leraton, set pre Num currNum, then get the next number into currNum Maintain a max difference variable Initialize it with 0 In each loop iteration, check if the difference between currNum and prevNum exceeds maxDiff, if so, update maxDiff with that difference Don't forget to take the absolute value of the difference before the above comparison Don't try to check the max difference for the first number in the list, since no previous number exists ACTIETY 27.15.1: Loops* Biggest difference 0/18 main.cpp Load default template 1 rinclude ctostream 2 using namespace std 4 int moino 6Type your code here. / 0 ,3 888, UJ cmd 2 cmd

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions