Jump to content


Photo

C#


  • Please log in to reply
3 replies to this topic

#1 Black_Belt_v1

Black_Belt_v1

    Young Padawan

  • Members
  • Pip
  • 91 posts

Posted 14 September 2005 - 10:12 PM

Okay umm i have a question

if i wanna make a "table" in C#,

i.e. * 9x1=9
9x2=18
so on...

with me only pressing enter, and not typing in "2" or "3" everytime.

how do i loop it? so it repeats the action instead of exiting when i press enter after
the code for the first one?

This is my code so far.

Posted Image

#2 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 15 September 2005 - 02:16 PM

Try a For...Next loop
I'm not a C# programmer but this should help i hope

(This is not C# it's Psuedo-Code, it should give the idea)

Psuedo-Code:

Dim TimeTable1 as integer
Dim ChangingNumber as Integer
Dim Answer as Decimal

TimeTable1 = 9 'Change the number as its what numbers are times by
ChangingAnswer = 0 'Will be times by the above chosen number
Answer = 0 'Keep as 0 so it can be added onto

Do While Index <= 10
Answer = TimeTable1 * ChangingNumber
ChangingNumber = ChangingNumber + 1
console1.write(answer)
Loop


Hope this helps.

James

#3 Black_Belt_v1

Black_Belt_v1

    Young Padawan

  • Members
  • Pip
  • 91 posts

Posted 15 September 2005 - 04:57 PM

are some of those comments? and dont i hafta declare integers and the string answer?

PS thx a bunch

Edited by Black_Belt_v1, 15 September 2005 - 04:58 PM.


#4 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 15 September 2005 - 06:47 PM

Sorry been using .NET

You would have Answer as a integer sorry about that :ph34r:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users