Aditya Joshi
2010-02-15 15:03:54 UTC
class codes
{
public:
char *opcode, *mcode, *clas;
int len;
void get(char *a, char *b, char *c, int d)
{
strcpy(opcode,a);
strcpy(mcode,b);
strcpy(clas, c);
len=d;
}
void put()
{
cout<<" "<
};
// Well now I create an array of objects
codes c[12]; // I suppose there's no need of 'new' here. It wont work either.
// And now comes the next part
c[0].get("MOVR", "01", "IS", 1);
c[1].get("MOVM", "02", "IS", 1);
c[2].get("ADD", "03", "IS", 1);
c[3].get("MUL", "04", "IS", 1);
c[4].get("SUB", "05", "IS", 1);
c[5].get("DIV", "06", "IS", 1);
// And so on.....
Now when I run it, the values are not loaded properly. Check out your debugger watch window for things like c[3].opcode ... Where am I wrong?
Please reply asap. Get ready for the five points.