Jump to content
Sign in to follow this  
Getz

Tolong C++!

Recommended Posts

Assalamualaikum..

Kalau dlm VB kita boleh tulis gini

Dim str As String

Dim n As Integer

n=6

str="I am " & n & " years old"

Camne dlm C++, cth:

char *str;

int n;

n=6;

str="I am " & n & " years old";

For sure tak jadi punye, masalahnya kalau dlm VB kita boleh pakai operator & utk append dengan variable n, camne dlm C++, apa operator dia?

TQ

Share this post


Link to post
Share on other sites

Kalau umur tu String mmg jadi, mcm mana nak append dgn data type lain? date ke, int ke,...

TQ

dlm contoh aku, umur (dalam int) dijadikan String dengan metod Format.

aku gunakan %d utk int sama seperti format dan argument dlm printf. tapi kalo utk date, beza sket..

CTime timeWrite;

timeWrite = GetCurrentTime();

// write the time out

CString str = timeWrite.Format("%d %b %y %H:%M:%S - ");

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