Read Name1, Age1 Read Name2, Age2 If Name1 > Name2 Swap Name1 and Name2 Swap Age1 and Age2 Output Name1 and Age1 Output Name2 and Age2
struct
with functions as fields.
public
and private
parts
Write a program that stores the integer marks of a student for several items of assessment, each of equal value. The program outputs the total and average mark.
An Abstract Data Type (ADT) consists of a set of values, a defined set of properties of these values, and a set of operations for processing the values.
mystrclass
integer_store.cpp
, provide the class header file
integer_store.h
.
#include "boolean.h" #include "integer_store.h" //------------------------------------------------------------- integer_store::integer_store(void) { Clear(); } //------------------------------------------------------------- integer_store::integer_store(int Value) { Store(Value); } //------------------------------------------------------------- void integer_store::Store(int Value) { ValuedStored = TRUE; TheValue = Value; } //------------------------------------------------------------- void integer_store::Clear(void) { ValuedStored = FALSE; } //------------------------------------------------------------- boolean integer_store::Retrieve(int &Value) { if (ValueStored) { Value = TheValue; return(TRUE); } else return(FALSE); } //-------------------------------------------------------------