My prof is touching on information hiding, and good programming techniques. He said it's a good idea to keep as much of the user interface (i.e., couts) in main, and then modify object variables through the use of functions.
Here's what I want to do:
I'm starting on a program that lets the user input the type of pizza (hand tossed, pan, deep dish), the size (s, m, l) and the toppings they want.
So far, here's what I've setup in my class:
#pragma once
#include <iostream>
using namespace std ;
const double SMALL = 10.00
const double MEDIUM = 14.00
const double LARGE = 17.00
const double TOPPING = 2.00
class Pizza
{
public:
void set ( ) ;
void outputDesc ( ) ;
double computePrice ( ) ;
private:
char type ;
char size ;
int toppings[7] ;
} ;
For the toppings, I figured the easiest way is to do a loop of some sort until they're finished inputting toppings (maximum of 7). The reason I'm using an array is because I have to include a function that outputs the object data, including each topping.
My question is this: How can I allow the user to input the toppings they want in main(), and then put that data into the array in my object without creating a temp array for user input?