UoW SG Corner

Welcome to UoW SG Corner, a forum for all of us!!! We can have a chit chat here, share anything we have! Make your university life more interesting with this forum! Enjoy it!!!
HomeHome  ­CalendarCalendar  ­FAQFAQ  ­SearchSearch  ­MemberlistMemberlist  ­UsergroupsUsergroups  ­RegisterRegister  ­Log inLog in  
Post new topic   Reply to topicShare | 
 

 n> hint and guide for lab 2.cpp

View previous topic View next topic Go down 
AuthorMessage
susastra



Number of posts: 11
Registration date: 2008-10-08

PostSubject: n> hint and guide for lab 2.cpp   October 9th 2008, 19:26

you guys figure it out how to do ?

im a bit blur here on how to print out the digits of the integer...

i alrdy try to use the char data type, it can print out the digits.
but how to swap, if it is char? blurblur...

need hints and guides...
Back to top Go down
View user profile
citsoon



Number of posts: 41
Age: 22
Location: Woodlands
Registration date: 2008-10-07

PostSubject: Re: n> hint and guide for lab 2.cpp   October 9th 2008, 20:46

instead of storing it to char, u should try to convert it to int type, so that when doing swapping of digits, just use the formula that Dr Heng given, 1234 actually to display on screen, is 1*1000 + 2*100 + 3*10 + 4


ok, this should be enough, if i state too clearly, then it's become meaningless, try to figure out.
Back to top Go down
View user profile http://clansgaf.motionsforum.com
xiaoming



Number of posts: 5
Age: 23
Registration date: 2008-10-07

PostSubject: Re: n> hint and guide for lab 2.cpp   October 9th 2008, 20:54

Hi guys, Dr heng said we should declare tat the work is done ourselves. How do we go bout doing tat? input a \\Work is done by XiaoMing? or do a "cout" stating the work is done by me?
Back to top Go down
View user profile
susastra



Number of posts: 11
Registration date: 2008-10-08

PostSubject: Re: n> hint and guide for lab 2.cpp   October 9th 2008, 21:03

well, the question did mention that n = 1234 is 1 integer.
so if 1234 is 1 integer, how to print it digit by digit ? o_o
still blur here..
Back to top Go down
View user profile
donysukardi
Admin


Number of posts: 54
Age: 19
Location: Holland Drive
Registration date: 2008-10-05

PostSubject: Re: n> hint and guide for lab 2.cpp   October 9th 2008, 21:13

xiaoming wrote:
Hi guys, Dr heng said we should declare tat the work is done ourselves. How do we go bout doing tat? input a \\Work is done by XiaoMing? or do a "cout" stating the work is done by me?


Just use the comment //blah blah blah

The hint is it has something to do with modulus %, try to figure it out..
Back to top Go down
View user profile http://uowsgcorner.forumotion.net
citsoon



Number of posts: 41
Age: 22
Location: Woodlands
Registration date: 2008-10-07

PostSubject: Re: n> hint and guide for lab 2.cpp   October 9th 2008, 21:16

susastra wrote:
well, the question did mention that n = 1234 is 1 integer.
so if 1234 is 1 integer, how to print it digit by digit ? o_o
still blur here..


ok, further hint, using multiplication we can obtain a 4 digits number, so using other type we can obtain the digits seperately.
Back to top Go down
View user profile http://clansgaf.motionsforum.com
susastra



Number of posts: 11
Registration date: 2008-10-08

PostSubject: Re: n> hint and guide for lab 2.cpp   October 9th 2008, 22:31

at last i got the answer -_-;;;
thx all for helping..
Back to top Go down
View user profile
citsoon



Number of posts: 41
Age: 22
Location: Woodlands
Registration date: 2008-10-07

PostSubject: Re: n> hint and guide for lab 2.cpp   October 10th 2008, 06:41

hope that i did help a bit....
Back to top Go down
View user profile http://clansgaf.motionsforum.com
kevin



Number of posts: 4
Registration date: 2008-10-11

PostSubject: Re: n> hint and guide for lab 2.cpp   October 11th 2008, 09:30

hmmm...i'm still thinking of how to actually swap the numbers
Back to top Go down
View user profile
citsoon



Number of posts: 41
Age: 22
Location: Woodlands
Registration date: 2008-10-07

PostSubject: Re: n> hint and guide for lab 2.cpp   October 12th 2008, 23:14

we learnt that in CSCI103, didn't we?? last few pages...
Back to top Go down
View user profile http://clansgaf.motionsforum.com
 

n> hint and guide for lab 2.cpp

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You cannot reply to topics in this forum
UoW SG Corner :: Classes :: CSCI114-
Post new topic   Reply to topic