Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Calling a Function in a class?

$
0
0
Would anybody be able to explain to me how I would call my functions in my class from my main, cause currently my only function that is displaying to the screen is my main. I know how to call a function normally but classes are new to me.

#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>

using namespace std;


class menuItemType 
{
public:
     void getData(menuItemType item[], ofstream& outData);
     void showMenu(menuItemType item[], ofstream& outData);
     void printCheck (double& total, double& tax, double& totalF, ofstream& outData);

private:
    string itemName;
    double itemCost;


};


int main()
{

ofstream outData;
outData.open("OutMenu.txt");

cout<< "                Welcome !:)/>           " << endl;
cout<< "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
cout<< "  *To select an Item from the list below,  " << endl;
cout<< "just indicate the Item number for the item \n\n" << endl;
				

outData << "             Welcome! :)/>        " << endl;
outData << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
outData << "  *To select an Item from the list below,  " << endl;
outData<< "just indicate the Item number for the item \n\n" << endl;


    menuItemType menu [8];
   /* getData(menu, outData); 
    showMenu(menu, outData);*/
	

    system("pause");

    return 0;
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>