Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
strint <-> intsr help
Author Message
Chimaera

Posted: Tue Nov 11, 2003 9:18 pm   Post subject: strint <-> intsr help

I'm having trouble with converting the numbers from integers to string even though I'm doing it the way the reference said it should be done.

 code: var num : int var fnum : string get num for i : 1 .. num - 1     num := num * i end for intstr (num) := fnum put fnum

I don't understand where exactly my error is or what I'm doing wrong. Can someone please help me out? btw my program is just a figuring out the factorial powers of whole numbers from 1..user input in case anybody was wondering. [/code]

Mazer

Posted: Tue Nov 11, 2003 9:56 pm   Post subject: Re: strint <-> intsr help

 code: intstr (num) := fnum

with that line you are trying to assign assign a string to a string that holds a number (whatever number num ends up being at the time).

intstr converts an integer to a string
strint converts a string to an integer (you might want to use the strintok function first)

what i think you want is
 code: num := strint (fnum)

of course that doesn't make any sense, especially considering fnum isn't defined. so maybe what i think you meant was
 code: fnum := intstr (num)
Chimaera

Posted: Tue Nov 11, 2003 9:59 pm   Post subject: (No subject)

thanks a bundle I finally got the program to work the way I wanted to because I reworded it the way you suggested.
Mazer

Posted: Tue Nov 11, 2003 10:04 pm   Post subject: (No subject)

happy to help. here, have some bits.

**puts on bits-gun silencer**
Tony

Posted: Tue Nov 11, 2003 11:18 pm   Post subject: (No subject)

Mazer wrote:
**puts on bits-gun silencer**

I still heard that I should ask dan to write up some code just to stop Mazer from recieving any bits
Tony's programming blog. DWITE - a programming contest.
AsianSensation

Posted: Wed Nov 12, 2003 12:48 am   Post subject: (No subject)

would it even matter?

Mazer will probably come up with Evasive Manuever II, and we'll all end up refilling ammo for his bit-gun anyways
Tony

Posted: Wed Nov 12, 2003 12:51 am   Post subject: (No subject)

he should still be recieving bits for Evasive Manuever I
Tony's programming blog. DWITE - a programming contest.
Mazer

Posted: Wed Nov 12, 2003 7:55 am   Post subject: (No subject)

*sniff* you guys... you really love my shitty game that much... makes me feel all warm and tingly inside.
**farts**
oh... so that's what it was... nm
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 8 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: