COP3530/Project4/Project4.cpp
2023-06-23 19:29:02 -04:00

41 lines
No EOL
1.3 KiB
C++

//Corey Williams
//COP3530 01Z
//Project 4
/*Write a C++ or Java application that creates a linked list of Circle objects/structures (i.e., class must be created).
The application can use the "IntSLLNode" and "IntSLList" classes (pp. 78 - 83) as a guide.
The application must provide the following features.
Allow insertion of multiple "Circle" objects/structures.
The Circle contains a "radius" data member.
The Circle also uses functions/methods "setRadius", "getRadius" and calculateArea (returns a double data type).
Invoke a method/function "DisplayAllElements" (i.e., must be written, traversal required; refer to "isInList" method, pg. 80) that receives
a "reference/pointer" formal parameter. This formal parameter specifies the "head" of the list.
The function/method must display all elements "position", "radius" , and "area"
*/
#include <iostream>
#include "cirSLList.h"
#include "circle.h"
using namespace std;
int main()
{
double r;
string userResp;
cirSLList CircleList;
do {
cout << "Enter radius for circle: ";
cin >> r;
CircleList.addToTail(r);
cout << "Would you like to add another circle? Y/N: ";
cin >> userResp;
} while (userResp != "N" and userResp != "n");
CircleList.displayAllElements();
}