GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Jul-2010, 09:03
Adeel.817 Adeel.817 is offline
New Member
 
Join Date: Jul 2010
Posts: 7
Adeel.817 has a little shameless behaviour in the past

Please correct this code


CPP / C++ / C Code:
#include<iostream.h>
using namespace std;
class array
{public:
array()
{int i;
for(i=0;i<10;i++)
num[i]=0;
}
void Inputc();
void Outputc();
array operator*(array);
private:
int num[10];
};


array array::operator *(array x)
{array temp;
int i;
for(i=0;i<10;i++)
temp.num[i]=num[i]*x.num[i];
return(temp);}
void array::Inputc(void)
{int i;
for(i=0;i<10;i++)
{cout<<"enter element "i+1": ";
cin>>num[i];
}
}
void array::Outputc(void)
{int i;
for(i=0;i<10;i++)
cout<<"num[i]"<<endl;
}
int main()
{array a,b,c;
cout<<"enter elements for 1st array:\n";
a.Inputc();
cout<<"enter elements for 2nd array:\n";
b.Inputc();
c=a*b;
cout"Object 1 :\n"; a.Outputc();
cout"Object 2 :\n"; b.Outputc();
cout<<"Multiplication of both objects :\n";
c.Outputc();
system("pause");
return 0;
}
Last edited by Adeel.817 : 15-Jul-2010 at 09:22. Reason: Please insert your C++ code between [cpp] & [/cpp] tags
  #2  
Old 15-Jul-2010, 10:24
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 969
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: Correct this code i needed urgently


What seems to be the problem? What needs to be corrected?
Does this code compile?
Does this code run without errors?
etc.
etc.
etc.

Taking five minutes to describe what you are seeing vs what you expect to see will save us all a great deal of time. For instance, had you explained that the code would not compile and that you got a specific compiler error, we could have saved the time it took me to write this response plus the time it took you to read it plus the time it took you to respond with more information which is a lot more time than it takes you to write it the first time. Get it?
  #3  
Old 15-Jul-2010, 13:10
Adeel.817 Adeel.817 is offline
New Member
 
Join Date: Jul 2010
Posts: 7
Adeel.817 has a little shameless behaviour in the past

Re: Correct this code i needed urgently


Quote:
Originally Posted by fakepoo
What seems to be the problem? What needs to be corrected?
Does this code compile?
Does this code run without errors?
etc.
etc.
etc.

Taking five minutes to describe what you are seeing vs what you expect to see will save us all a great deal of time. For instance, had you explained that the code would not compile and that you got a specific compiler error, we could have saved the time it took me to write this response plus the time it took you to read it plus the time it took you to respond with more information which is a lot more time than it takes you to write it the first time. Get it?
I want run this code without erorr.
  #4  
Old 15-Jul-2010, 14:47
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 969
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: Correct this code i needed urgently


I guess we'll have to do this the slow way. I will ask a question. You can answer. I will then ask another question. You can then answer that one. Eventually we will be at a solution.

Question #1:
What compiler error are you getting?
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help in learning C++ Matie C++ Forum 4 26-May-2010 05:02
Here it is again! 35% - 40% off For Life! my-e-space Web Hosting Advertisements & Offers 0 20-Apr-2006 14:48
Selection Sorting--Help Urgently Needed TetrahedreX C Programming Language 2 03-May-2005 10:57
Code Library Elmseeker PHP Code Library 0 13-Jan-2003 08:58

Network Sites: GIDNetwork · GIDApp · GIDBlog · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:18.


vBulletin, Copyright © 2000 - 2017, Jelsoft Enterprises Ltd.