Scopri come trovare astrologi esperti nel campo dell'astrologia con il nostro articolo. Approfondiremo le diverse tecniche e risorse per identificare professionisti qualificati, evidenziando l'importanza di una buona reputazione e delle recensioni. Non perdere l'opportunità di migliorare la tua esperienza astrologica!
Trova professionisti vicino a te
Trova professionisti
#include
#include
#include
#include
#include "llist.h"
#include "graph.h"
#include "queue.h"
#include "stack.h"
using namespace std;
/*
* Author: Jared Short
* Creation date: 10/02/14
*/
int main()
{
// Declare variables
int i;
int j;
int k;
int choice;
int x;
int y;
int count;
int max;
LList list;
Graph g;
Queue q;
Stack s;
// Create menu
cout << "Please choose from the following options:" << endl;
cout << "1. Create a Graph" << endl;
cout << "2. Create a Linked List" << endl;
cout << "3. Create a Queue" << endl;
cout << "4. Create a Stack" << endl;
cout << "5. Exit" << endl;
// Get input
cin >> choice;
// Process input
switch (choice)
{
case 1:
cout << "Please enter the number of vertices you wish to create:" << endl;
cin >> x;
cout << "Please enter the maximum number of edges:" << endl;
cin >> max;
// Initialize graph
g.init_graph(x, max);
// Create edges
for (i = 0; i < x; i++)
{
for (j = 0; j < x; j++)
{
cout << "Please enter a weight between vertex " << i << " and vertex " << j << ":" << endl;
cin >> k;
g.insert_edge(i, j, k);
}
}
// Display graph
cout << "Graph successfully created!" << endl;
cout << g;
break;
// Create linked list
case 2:
cout << "Please enter the number of elements you would like to create in your list:" << endl;
cin >> count;
// Create list
for (i = 0; i < count; i++)
{
cout << "Please enter the element:" << endl;
cin >> x;
list.insert(x);
}
// Display list
cout << "Linked list successfully created!" << endl;
cout << list;
break;
// Create queue
case 3:
cout << "Please enter the number of elements you would like to create in your queue:" << endl;
cin >> count;
// Create queue
for (i = 0; i < count; i++)
{
cout << "Please enter the element:" << endl;
cin >> x;
q.enqueue(x);
}
// Display queue
cout << "Queue successfully created!" << endl;
cout << q;
break;
// Create stack
case 4:
cout << "Please enter the number of elements you would like to create in your stack:" << endl;
cin >> count;
// Create stack
for (i = 0; i < count; i++)
{
cout << "Please enter the element:" << endl;
cin >> x;
s.push(x);
}
// Display stack
cout << "Stack successfully created!" << endl;
cout << s;
break;
// Exit
case 5:
break;
// Error message
default:
cout << "That is not a valid option." << endl;
}
// Pause
cin >> y;
// End program
return 0;
}