Jump to content
Sign in to follow this  
nero

Pasal Array

Recommended Posts

a'kum seme...

aku ader confius skit la..

cmner nak wat amik data yang ader dalam array, masuk kedalam array yang lain..

ak tak de idea la...

tolong beb.....

Share this post


Link to post
Share on other sites

ok....thanks..

bole tlong skit kat coding ni skit tak.....

ak try nak wat objek dalam bntuk multidimensional...

tapi tak jdk plk....

cmne tu en. pot pet?

# include <iostream.h>
# include <conio.h>
class samp{
int a;
public:
samp(int n) { a = n;}
int get_a() { return a; }
};

int main()
{

samp ob[4][2] = {
1, 2,
3, 4,
5, 6,
7, 8,
};

int i,j;
samp *p;
/* for(i=0; i<4; i++) { <-------NI yang ak try wat, tp tak jadk
*p=obj;
for(j=0; j<2; j++)
{p=obj[]; }} */

for(i=0; i<4; i++){
for(j=0; j<2; j++){
cout<<"ob["<<i<<"]["<<j<<"]= "<<p->get_a() << ' ' ;
cout<<"ob["<<i<<"]["<<j<<"]= "<<p->get_a() << "\n";
//p++;
} }

cout << "\n";
getch();
return 0;
};[/codebox]

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...