Server IP : 172.16.15.8 / Your IP : 3.135.204.43 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/mrlong/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
#include <iostream> using namespace std; // prototypes void menu(); template<class T> void process(); const int = 100; List() { length = 0 } int Length { int main() { char ch; string a, b, c; menu(); cin >> ch; while(tolower(ch) != 'q') { switch (tolower(ch)) { case 'i': cout << "\tNow play the integer list - "; process<int>(); break; case 'c': cout << "\tNow play the char list - "; process<char>(); break; case 'x': cout << "\tNow play with the string list - "; process<string>(); cin.ignore(); // '\n' //string a, b, c; getline(cin, a); cout << "\tInput the second full name: "; getline(cin, b); c = GetMax<string> (a, b); cout << "\n\n\tThe bigger one is: " << c << "\n"; break; default: cout << "\n\tInvalid, redo it\n\n"; } menu(); cin >> ch; } cout << "\n\nBye.\n\n"; return 0; } //--------------------------------- template<class T> void process() { char slecetion; cout <<"\n\nProcessess here... \n\n"; list z; void process() cin >> selection; cout << "\n\n\tThe bigger one is: " << c << "\n\n"; while(toloware (selection ! = 'q') { switch (tolower(selection) ) { case 'i' cout << "Input an item: "; cin >> item; z.insert(item); break; case 'p': cout << "\n\nThe list is: \n"; z.Print(); break; case "'s": cout << "\tNow play with the string list - "; process<string>(); break; default: cout << "\n\nInvalid. Try again... \n"; } menuForList(); cin >> selection; } } //--------------------------------- template <class T> T GetMax (T a, T b) { T result = b; if(a > b) result = a; return (result); } //--------------------------------- void menu() { cout << "\n\n\t--- Welcome to the Bigger Game! ---\n"; cout << "\t =========================\n\n"; cout << "\tI to insert name to list.\n"; cout << "\tC \n"; cout << "\tX to print te list ./";General strings\n"; cout << "\tQ Quit\n"; cout << "\t--------------------\n"; cout << "\n\tYour choice: "; }