Click here to Skip to main content
15,898,588 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionExecuting program error. Pin
Nikesh Jagtap16-Nov-08 18:47
Nikesh Jagtap16-Nov-08 18:47 
QuestionRe: Executing program error. Pin
David Crow17-Nov-08 3:27
David Crow17-Nov-08 3:27 
QuestionWrite data n PDF and Excel Pin
MsmVc16-Nov-08 17:18
MsmVc16-Nov-08 17:18 
AnswerRe: Write data n PDF and Excel Pin
Hamid_RT16-Nov-08 17:56
Hamid_RT16-Nov-08 17:56 
QuestionIncorrect binary path set during Win32 Service installation Pin
Member 569752116-Nov-08 16:00
Member 569752116-Nov-08 16:00 
Questionminimum spanning tree Pin
Sadaiyappan16-Nov-08 9:54
Sadaiyappan16-Nov-08 9:54 
AnswerRe: minimum spanning tree Pin
Sarath C16-Nov-08 19:11
Sarath C16-Nov-08 19:11 
Questionhey plz fix this code it got errors urgent Pin
jazikhan00116-Nov-08 8:46
jazikhan00116-Nov-08 8:46 
#include<iostream.h>
#include<string.h>
enum Status{outoforder,ok};

//enum bool{false,true};
template <class T>
class List{
public :
List () { }
List (int s){
maxSize=s;
used=0;
a= new T [maxSize];
}
//~List () { delete []a;}
bool addObjects(T p){
if (!isFull()){
a[used]=p;
used ++;
return true;
}
else
return false;
}
int getMaxSize() { return maxSize;}

int getUsed() { return used;}
bool setObject (int index,T p )
{ if ((index <used )&&(index>=0)){
a[index]=p;
return true;
}
else
return false;
}

bool getObject (int index,T &p )
{ if (!isEmpty()) {
if ((index <used )&&(index>=0)){
p=a[index];
return true;
}
else
return false;
}
else
return false;
}

int isFull() { return used==maxSize;}
int isEmpty () { return used==0;}

private :
T *a;
int maxSize;
int used;
};
class HardDisk{
public:
HardDisk(){}
HardDisk(int c){cap=c;}
void setHd(int c){cap=c;}
int getHd(){return cap;}
private:
int cap;
};
class Processor{
public:
Processor(){}
Processor(float c){Cs=c;}
void SetPro(float c){Cs=c;}
float getPro(){return Cs;}
private:
float Cs;
};

class Ram{
public:
Ram(){}
Ram(int c){Cap=c;}
void setRam(int c){Cap=c;}
int getRam(){return Cap;}
private:
int Cap;
};

class Monitor{
public:
Monitor(){}
Monitor(char *t){strcpy(Type,t);}
void setM(char *t){strcpy(Type,t);}
char* getM(){return Type;}
private:
char Type[15];
};
class Keyboard{
public:
Keyboard(){}
Keyboard(char *t){strcpy(Type,t);}
void setK(char *t){strcpy(Type,t);}
char* getK(){return Type;}
private:
char Type[15];


};
class Mouse{
public:
Mouse(){}
Mouse(char *t){strcpy(Type,t);}
void setMo(char *t){strcpy(Type,t);}
char* getMo(){return Type;}
private:
char Type[15];

};
class CdRom{
public:
CdRom(){}
CdRom(char *t){strcpy(Type,t);}
void setCd(char *t){strcpy(Type,t);}
char* getCd(){return Type;}

private:
char Type[15];
};
class Speaker{
public:
Speaker(){}

Speaker(char* s){Size=s;}
void setSpeaker(char* s){Size=s;}
char* getSpeaker(){return Size;}
private:
char* Size;

};
class Computer{

public:
Computer(){}
Computer(Status s, int h,float pr,int rm,char* m,char *kb,char *mon):hd(h),p(pr),r(rm),m(mon),mo(m),k(kb){
status=s;}// cd=NULL;s=NULL;}

void setStatus(Status s){status=s;}
Status getStatus(){return status;}

void setHardDisk(int h){hd.setHd(h);}
int getHardDisk(){return hd.getHd();}

void setProcessor(float pr){p.SetPro(pr);}
float getProcessor(){return p.getPro();}

void setRam(int ra){r.setRam(ra);}
int getRam(){r.getRam();}

void setMonitor(char *mo){m.setM(mo);}
char *getMonitor(){return m.getM();}

void setKeyboard(char *ke){k.setK(ke);}
char *getKeyboard(){return k.getK();}

void setMouse(char *m){mo.setMo(m);}
char *getMouse(){return mo.getMo();}

void setCd(char *c){
if(cd!=NULL)
cd->setCd(c);
}
char * getCd(){
if(cd!=NULL)
return cd->getCd();
else
return NULL;
}
void setSpeaker(char *c){
if(s!=NULL)
s->setSpeaker(c);
}
char * getSpeaker(){
if(s!=NULL)
return s->getSpeaker();
else
return NULL;
}
int addSpeaker(char *t){
if(s==NULL){
s=new Speaker(t);
return 1;
}
else
return 0;
}
int removeSpeaker(){
if(s!=NULL){
delete s;
return 1;
}
else
return 0;
}


int addCd(char *t){
if(cd==NULL){
cd=new CdRom(t);
return 1;
}
else
return 0;
}
int removeCd(){
if(cd!=NULL){
delete cd;
return 1;
}
else
return 0;
}
/* void print(){
cout<<"\n.....................................\n";
cout<<"Status = "<<status<<endl;
cout<<"Hard Disk = "<<getHardDisk()<<endl;
cout<<"Processor = "<<getProcessor()<<endl;
cout<<"Ram = "<<getRam()<<endl;
cout<<"KeyBoard = "<<getKeyboard()<<endl;
cout<<"Monitor = "<<getMonitor()<<endl;
cout<<"Mouse = "<<getMouse()<<endl;
if(cd!=NULL){
{ cout<<"CDROM = "<<getCd()<<endl;}
else
cout<<"No CD Rom "<<endl;


if(s!=NULL){
cout<<"Speaker = "<<getSpeaker()<<endl;
else
cout<<"No Speaker "<<endl;
}
} */

private:
Status status;
HardDisk hd;
Processor p;
Ram r;
Monitor m;
Keyboard k;
Mouse mo;
CdRom *cd;
Speaker *s;
};

class Lab{
public:
Lab(int no , int size):ls(size){
labno=no;
}
int addComputer(Computer p){return ls.addObjects(p);}
void printComputer(){
Computer t;
for(int i=0;i<ls.getUsed();i++){
ls.getObject(i,t);
//t,print();
}
}
private:
int labno;
List <Computer> ls;
};
void main(){
Lab l1(1,10),l2(2,10),l3(3,10);
Computer ob (ok,80,2000,1,"Ball","Standard","14 in Flat ");
//ob.print();
l1.addComputer(ob);
}
AnswerRe: hey plz fix this code it got errors urgent Pin
Peter Weyzen16-Nov-08 9:46
Peter Weyzen16-Nov-08 9:46 
GeneralRe: hey plz fix this code it got errors urgent Pin
jazikhan00116-Nov-08 9:50
jazikhan00116-Nov-08 9:50 
AnswerRe: hey plz fix this code it got errors urgent Pin
22491717-Nov-08 12:42
22491717-Nov-08 12:42 
AnswerRe: hey plz fix this code it got errors urgent Pin
Iain Clarke, Warrior Programmer18-Nov-08 2:40
Iain Clarke, Warrior Programmer18-Nov-08 2:40 
QuestionA beginner question about winforms in VC++ Pin
Pedram Behroozi16-Nov-08 4:42
Pedram Behroozi16-Nov-08 4:42 
AnswerRe: A beginner question about winforms in VC++ Pin
Mark Salsbery16-Nov-08 6:14
Mark Salsbery16-Nov-08 6:14 
GeneralRe: A beginner question about winforms in VC++ Pin
Pedram Behroozi16-Nov-08 7:42
Pedram Behroozi16-Nov-08 7:42 
AnswerRe: A beginner question about winforms in VC++ Pin
Jijo.Raj16-Nov-08 7:07
Jijo.Raj16-Nov-08 7:07 
GeneralRe: A beginner question about winforms in VC++ Pin
Pedram Behroozi16-Nov-08 7:47
Pedram Behroozi16-Nov-08 7:47 
GeneralRe: A beginner question about winforms in VC++ Pin
Jijo.Raj16-Nov-08 8:13
Jijo.Raj16-Nov-08 8:13 
GeneralRe: A beginner question about winforms in VC++ Pin
N a v a n e e t h16-Nov-08 16:53
N a v a n e e t h16-Nov-08 16:53 
GeneralRe: A beginner question about winforms in VC++ Pin
Pedram Behroozi16-Nov-08 22:02
Pedram Behroozi16-Nov-08 22:02 
QuestionCEdit Control Pin
john563215-Nov-08 21:04
john563215-Nov-08 21:04 
AnswerRe: CEdit Control Pin
Garth J Lancaster15-Nov-08 22:47
professionalGarth J Lancaster15-Nov-08 22:47 
QuestionRe: CEdit Control Pin
CPallini15-Nov-08 23:01
mveCPallini15-Nov-08 23:01 
AnswerRe: CEdit Control Pin
Garth J Lancaster15-Nov-08 23:15
professionalGarth J Lancaster15-Nov-08 23:15 
GeneralRe: CEdit Control Pin
CPallini15-Nov-08 23:52
mveCPallini15-Nov-08 23:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.