Pixel2Life Forum: C# - Desktop Programming - Pixel2Life Forum

Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

C#

Array

#1 User is offline   Black_Belt_v1 

  • Young Padawan
  • Pip
  • Group: Members
  • posts 91
  • Joined: 16-March 05

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
0

#2 User is offline   ronson 

  • Banned For Being Purple
  • PipPip
  • Group: Twodded Staff
  • posts 480
  • Joined: 25-September 04
  • 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
0

#3 User is offline   Black_Belt_v1 

  • Young Padawan
  • Pip
  • Group: Members
  • posts 91
  • Joined: 16-March 05

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.

0

#4 User is offline   ronson 

  • Banned For Being Purple
  • PipPip
  • Group: Twodded Staff
  • posts 480
  • Joined: 25-September 04
  • 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

Share this topic:


  • You cannot start a new topic
  • You cannot reply to this topic

0 user(s) are reading this topic
members, guests, anonymous users