Ich habe dieses einfache Programm erstellt, um die Arbeit mit Klassen zu üben. Ich bin mir sicher, dass es einige Fehler mit der Art und Weise gibt, wie ich die Klasse verwendet habe, aber ich fange gerade an, etwas über sie zu lernen, also habe ich nicht alle Konventionen und Etikette gelernt. Meine Hauptfrage ist, kann Xcode Funktionen haben, die gepuffert sind, und andere Funktionen, die nicht gepuffert sind? Ich möchte, dass meine Funktion void InputValuesandDisplayTotals (); gepuffert werden und meine Funktion void manuelladdcoinsandDisplayTotals (); nicht gepaufelt sein (im Grunde genommen klicken Sie auf einen Schlüssel und das Zeichen wird sofort verarbeitet, ohne die Eingabetaste zu verwenden). Ist das möglich? < /P>
Code: Select all
#include
#include
using namespace std;
class Coin
{
private:
const float PENNYVALUE = 0.01;
const float NICKELVALUE = 0.05;
const float DIMEVALUE = 0.10;
const float QUARTERVALUE = 0.25;
int PennyInput=0;
int NickelInput=0;
int DimeInput=0;
int QuarterInput=0;
public:
void InputValuesAndDisplayTotals();
void ManuallyAddCoinsAndDisplayTotals();
void Total();
};
int main()
{
int Choice;
Coin Count;
cout > Choice;
if (Choice==1)
{
Count.InputValuesAndDisplayTotals();
Count.Total();
}
else
{
Count.ManuallyAddCoinsAndDisplayTotals();
}
cout