Page 2 of 2

Basic C++

Posted: Wed May 25, 2005 4:03 pm
by wtd
Some simple Turing -> Python comparisons

Conditionals:

Code: Select all

if 42 < 34 then
   put "Hello"
elsif 56 > 89 then
   put "World"
else
   put "Foo bar!"
end if[code]

[code]if 42 < 34:
   print "Hello"
elif 56 > 89:
   print "World"
else:
   print "Foo bar!"[code]

Defining a function:

[code]function square (a : int) : int
   result a * a
end square[code]

[code]def square(a):
   return a * a[code]

While loop:

[code]var counter := 0

loop
   put "Hello"
   counter += 1
   exit when counter = 5
end loop[code]

[code]counter = 0

while counter < 5:
   put "Hello"
   counter += 1[code]

Looping over an array/list:

[code]var arr : array 1 .. 5 of int := init (3, 4, 1, 7, 8)

for i : 1 .. upper (arr)
   put arr (i)
end for[code]

[code]arr = [3, 4, 1, 7, 8]

for x in arr:
   put arr[code] 

[color=#888888][size=85]Archived topic from Iceteks,  old topic ID:3314, old post ID:27094[/size][/color]

Basic C++

Posted: Wed May 25, 2005 5:46 pm
by syb
Okay thank. I am sure i'll have some questions.

I just thought of one. You said your running linux right now. Well i was wondering if you knew how to partion with linux already as your OS.

I am using redhat 8.0 and want to put daul boot (one as win 2k and the other as redhat) on it but all the stuff i've found was how to partion with win 2k then put on linux.

Archived topic from Iceteks, old topic ID:3314, old post ID:27096

Basic C++

Posted: Wed May 25, 2005 6:17 pm
by wtd
When you dual boot with Windows, always install Windows first. Windows doesn't play well with others, but Linux does, so if Windows goes second it'll screw up the bootloader. If Linux goes second, Windows basically doesn't even know it's there, which is just fine. :)

Archived topic from Iceteks, old topic ID:3314, old post ID:27097

Basic C++

Posted: Wed May 25, 2005 6:24 pm
by Red Squirrel
Yeah just ensure to install a linux bootloader so you can boot windows and linux, and NEVER uninstall that installation of linux, unless you plan to fdisk your entire drive. I learn't that the hard way. :D

Actually, there's ways to recover from that, but they're a risk, it involves rebuilding the MBR and well, if it goes wrong, you're screwed. (I believe this would even affect non-bootable partitions on that drive, but I'm not 100% sure)

Archived topic from Iceteks, old topic ID:3314, old post ID:27098

Basic C++

Posted: Wed May 25, 2005 6:50 pm
by syb
or you can whip out the MBR ( if MBR means master boot record) If you have nothing worth saving. Okay thanks. I'll install win 2k then put on linux.

Archived topic from Iceteks, old topic ID:3314, old post ID:27101

Basic C++

Posted: Fri Jun 03, 2005 5:35 pm
by MikeDB
well i see alot of people sort of answerd. Sorry i took so long i had a problem with my parents but anyways i started up a new website oh and when you get there just to let you know that you internet is not down just keep scrolling down till you find a link saying ENTER ok http://members.shaw.ca/mike-db (its not quite done yet but its getting there :biglaugh:

Archived topic from Iceteks, old topic ID:3314, old post ID:27223

Basic C++

Posted: Wed Jun 08, 2005 1:14 am
by aznsamaritan
._. im confjused..

Archived topic from Iceteks, old topic ID:3314, old post ID:27291

Basic C++

Posted: Wed Jun 08, 2005 4:42 pm
by wtd
aznsamaritan wrote: ._. im confjused..
About what?

Archived topic from Iceteks, old topic ID:3314, old post ID:27302