Jump to content
Sign in to follow this  
deqna_aryna

Coding Utk Array Camne Ek?

Recommended Posts

akum...hi...sape2 plez la tolong deqna...ni thp nk muntah dah ni... deqna penin lg ni..ni pasal nk masukkan coding utk array..cth if kite masukkan nilai 20 (ulangan akan dilakukan sebanyak 20x pd output...) sad.gif

void CCreate::OnChangeGeneration()

{

// TODO: If this is a RICHEDIT control, the control will not

// send this notification unless you override the CDialog::OnInitDialog()

// function and call CRichEditCtrl().SetEventMask()

// with the ENM_CHANGE flag ORed into the mask.

"nak masuk kat dalam ni kan? deqna dh try tapi yang tu error..deqna try refer buku..cam tak jadik je"

// TODO: Add your control notification handler code here

}

Share this post


Link to post
Share on other sites

deqna, program tu melibatkan looping, cthnya:

int array[];

for (int i = 0;i<20;i++)
  {
           
    // buat print ke skrin kat sini

  }

pandai-pandai lah fitkan code tu kat dlm program awak yer..

awak kalau nak belajar program dalam C++ , jgn terus lompat guna MFC. belajar dulu guna console.

Edited by puteranetwork

Share this post


Link to post
Share on other sites

tongue.gif

kalau dengan perempuan..baik betul en puteranetwork

eh.. ye ke? takde lah, aku layan semuanya sama biggrin.gif

int array[];
boleh ke buat array mcm tu? ntah? main agak-agak je, sbb dah banyak luper. kalau silap betulkan lah ye en zeph..! tongue.gif
int array[20] = "20";

sbb dia nak display value "20" sebanyak 20 kali kan? so camtu le kot rupanya.

Edited by puteranetwork

Share this post


Link to post
Share on other sites

// zeph.. please delete this post

/// takde butang delete pun

//// takde? lorr.. takpelah.

Edited by puteranetwork

Share this post


Link to post
Share on other sites

hahahahaa... z++.. nak jugak belajau..

akum...hi...sape2 plez la tolong deqna...ni thp nk muntah dah ni... deqna penin lg ni..ni pasal nk masukkan coding utk array..cth if kite masukkan nilai 20 (ulangan akan dilakukan sebanyak 20x pd output...)

jap2... kalau ikut ayat deqna ni.. (masukkan value(cth 20), output dia pon kuar 20 kali kan?) ini bukan array... ni mcm count utk looping...

cin<<count;

x=0;

while x<= count

{ cin<<value[x];

x++;}

y=0;

while y<=count

{ cout>>value[y];

y++;}

p/s: entah betul ke x coding aku ni.... pandai2 laa adjust balik.. aku mmg dah lupa dah syntax c++

Edited by aRmsTer

Share this post


Link to post
Share on other sites
cin>>count;
x=0;
y=0;
while (x<count)
{ 
    cin>>value[x];
    value[y]=value[x];
     y++;
     x++;
}

y=0;
while (y<count)
{ 
    cout<<value[y];
    y++;
}

Edited by zeph

Share this post


Link to post
Share on other sites
cin>>count;
x=0;
while (x < count)
{ 
   cin>>value[x];
   x++;
}

x=0;
while (x < count)
{ 
   cout<<value[x];
   x++;
}

Edited by siti

Share this post


Link to post
Share on other sites

thnx for de correction there...

so deqna, is these codes the one u want or actually awak nak tanya bende lain coz based on ur question(laahh) tis should be the correct answer (not de best but still acceptable)

Share this post


Link to post
Share on other sites

int array[20] = "20";  ?????  blink.gif

bahasa c++ ke? bahasa z++?

pembetulan;

int array[20] = {20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20};
memula ingat nak guna for loop then terus buat array print;
#include <stdio.h>

int main()
{

	int array[20] = {20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20};
	int index;

	for (index = 0; index < 20; index++)

	printf(" Array dalam %2d ialah %d\n", index, array[index]);

return 0;

}

// armster tu punyer dah betul dah tu rasanya.

Edited by puteranetwork

Share this post


Link to post
Share on other sites

int x = 'F'; // boleh

char y = 0x100; // tak boleh

bukan ke

int array[20] = "20";  // ?????   
boleh jalan gak tongue.gif ------------------------------------ edited again; adeh~ lupa lak principle dia (code atas tak jalan) but this must be work
int x = 12338; // 0x00003032 (satu byte membazir :P)
char *y = (char *)&x;
printf("%s\n",y);
-------------
output: 20 // also array concept

minta maaf salah silap kod kat atas tu ek tongue.gif~

Edited by raihan

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...