Hi
Im trying to write a program that allows me to enter relevant infomation(shows on programme).
But now im stuck I want the user to be able to put there own info as many times as they state and then be able to display it.
Any help appreciated?
Thanks
Code:
#include"stdafx.h"//
#include<iostream.>//
#include<string.h>//
#include<sstream>
usingnamespace std; //
//------------------------------------------------------------------

class MB // Setting for creating Motherboard class.
{
public: // Constructors Public.
MB(char * , longdouble, float); // Define programs parameters.
void show_MB(void); // 
private: // Constructors private.
char MBP [25]; // Required specification.
longdouble MBM; // Required specification.
float MBR; // Required specification.
};
//-------------------------------------------------------------------------
MB::MB(char * MBP, longdouble MBM, float MBR) // Order of sequence.
//-------------------------------------------------------------------------
{
strcpy(MB::MBP, MBP); // Relates to program within.
MB::MBM = MBM; // Relates to program within.
MB::MBR = MBR; // Relates to program within.
};
//-------------------------------------------------------------------
void MB::show_MB(void) 
{
cout << "Processor: " << MBP << endl; // Display.
cout << "Speed: " << MBM << " Mhz " << endl; // Display.
cout << "RAM: " << MBR << " GB " << endl; // Display.
};
//--------------------------------------------------------------------------------
class VC // Setting for creating Video Card class.
{
public: // Constructors Public.
VC(char *, int, int, float); // Define programs parameters.
void show_VC(void); //
private: // Constructors private.
char VCB [25]; // Required specification.
int VCX; // Required specification.
int VCY; // Required specification.
float VCM; // Required specification.
};
//------------------------------------------------------------------------------
VC::VC(char * VCB, int VCX, int VCY, float VCM) // Order of sequence.
//-----------------------------------------------------------------------------
{
strcpy(VC::VCB, VCB); // Relates to program within.
VC::VCX = VCX; // Relates to program within.
VC::VCY = VCY; // Relates to program within.
VC::VCM = VCM; // Relates to program within.
};
//-------------------------------------------------------------------------------
void VC::show_VC(void)
{
cout << "Brand: " << VCB << endl; // Display.
cout << "Display: " <<VCX<< " X " <<VCY<< endl; // Display.
cout << "RAM: " << VCM << " GB " << endl; // Display.
};
 
//--------------------------------------------------------------------------------
class COMPUTER : public MB, public VC // Setting for creating Computer class.
{
public: // Constructors Public.
COMPUTER(char *, int, float, char *, longdouble, float, char *, int, int, float); // Define programs parameters.
void show_COMPUTER(void);
private:
char B[25]; // Required specification.
int HD; // Required specification.
float P; // Required specification.
};
//-----------------------------------------------------------------------------------------------
COMPUTER::COMPUTER(char * B, int HD, float P, // A parameters.
char * MBP,longdouble MBM, float MBR, // MB parameters.
char * VCB, int VCX, int VCY, float VCM) // VC parameters.
: MB(MBP, MBM, MBR ), VC(VCB, VCX, VCY, VCM ) // Within A Parameters.
//-------------------------------------------------------------------------------------------------
{
strcpy(COMPUTER::B, B); // Relates to program within.
COMPUTER::HD = HD; // Relates to program within.
COMPUTER::P = P; // Relates to program within.
MB (MBP,MBM,MBR); // Relates to program within.
VC (VCB,VCX,VCY,VCM); // Relates to program within.
}
//----------------------------------------------------------------------------------------
void COMPUTER::show_COMPUTER(void)
{
cout << "Brand: " << B << endl;
cout << "Hard disk: " << HD << " Gb" << endl;
cout << "Price: " << P << endl;
show_MB();
show_VC();
}
//void main(void)
//-----------------------------------------------------------------------------------------------
int main () // This is where the program starts it execution. Itís also the main function
{{
char B, MBP, VCB [25];
int HD, P, MBR, MBM, VCX, VCY, VCR;
int X, Y; // Defines variables
 
//--------------------------------------------------------------------------------------------------------------------------------
cout << "Enter number of computer sprecifications required? "; // Displays A Task Title
cin >> X; // Stores Entered Values
for ( Y=X; Y>=X; Y--); // Starts repeating statemen

//--------------------------------------------------------------------------------------------------------------------------------
{{{{{{{{{{
cout << "Please Enter Brand? "; // Displays A Task Title
cin >> B; // Stores Entered Values
cout << "Please Enter Hardrive Size? "; // Displays A Task Title
cin >> HD; // Stores Entered Values
cout << "Please Enter Price? "; // Displays A Task Title
cin >> P; // Stores Entered Values
cout << "Please Enter Processor? "; // Displays A Task Title
cin >> MBP; // Stores Entered Values
cout << "Please Enter Motherboard RAM? "; // Displays A Task Title
cin >> MBR; // Stores Entered Values
cout << "Please Enter Motherboard Memory? "; // Displays A Task Title
cin >> MBM; // Stores Entered Values
cout << "Please Enter Graphics Card Brand? "; // Displays A Task Title
cin >> VCB; // Stores Entered Values
cout << "Please Enter X Display? "; // Displays A Task Title
cin >> VCX; // Stores Entered Values
cout << "Please Enter Y Display? "; // Displays A Task Title
cin >> VCY; // Stores Entered Values
cout << "Please Enter Video Card RAM? "; // Displays A Task Title
cin >> VCR; // Stores Entered Values
}}}}}}}}}};
//-----------------------------------------------------------------------------------
{ 
COMPUTER PC("B", HD, P, "MBP", MBR, MBM, "VCB", VCX, VCY, VCR); PC.show_COMPUTER(); 
//return(0);
}}
system("pause>nul"); 
};