Question: LAB main.cppcin > > stringArg 2 ; cin > > stringArg 3 ; cin > > stringArg 4 ; / / Check order of four

LAB main.cppcin >> stringArg2;
cin >> stringArg3;
cin >> stringArg4;
// Check order of four strings
cout "Order: " CheckOrder(stringArg1, stringArg2, stringArg3, stringArg4) endl;
// Read in four doubles
double doubleArg1, doubleArg2, doubleArg3, doubleArg4;
cin >> doubleArg1;
cin >> doubleArg2;
cin >> doubleArg3;
cin >> doubleArg4;
// Check order of four doubles
cout "Order: " CheckOrder(doubleArg1, doubleArg2, doubleArg3, doubleArg4) endl;
return 0;
13.4.1: LAB: What order? (function templates)
Define a generic function called CheckOrder() that checks if four items are in ascending, neither, or descending order. The function
should return -1 if the items are in ascending order, 0 if the items are unordered, and 1 if the items are in descending order.
The program reads four items from input and outputs if the items are ordered. The items can be different types, including integers,
strings, characters, or doubles.
Ex. If the input is:63.296.5100.1123.5the output is:
Order: -1
Order: -1
main.cpp#include
LAB main.cppcin > > stringArg 2 ; cin > >

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!