#include // ask for numeric input until it's nonnegative int main() { // the length of an array must be known at compile time! const int length = 10; double values[length] = {}; // prompt user for input std::cout < "enter="" "="">< length="">< "="" values..."="">< std::endl;="" for="" (int="" idx="0;" idx="">< length;="" idx++)="" {="" std::cout="">< "values["="">< idx="">< "]="; std::cin >> values[idx]; // read one value from keyboard } // echo back the array std::cout << " you="" entered:="" "="">< std::endl;="" for="" (int="" idx="0;" idx="">< length;="" idx++)="" {="" std::cout="">< values[idx]="">< ",";="" }="" std::cout="">< std::endl;="" return="" 0;="" }="" above="" is="" the="">
Extracted text: 8. Starting with echo_array.cpp, write a program which accepts an array of double values of length five from the standard input. The program should print "ascending" if the sequence is in ascending order, "not ascending" otherwise. Filename: is-ascending-dls369.cpp, but replace my email id with yours. Here are some test cases: {0, 0, 0, о, о } true • { 0, 0, 0, 0, 1.1 } H true • { -1.1, O, 0, 0, o } + true • { 1.1, 0, 0, 0, 0 } H false • { 0, 0, 0, 0, -1.1 } → false . {0, 0, о, 1.1, 0 } н false • { -1.6, -0.44, 0, 1.2, 2.4 } → true