Mirage Source
http://miragesource.net/forums/

Yay C++
http://miragesource.net/forums/viewtopic.php?f=142&t=5478
Page 1 of 1

Author:  Tony [ Sun Apr 12, 2009 2:27 pm ]
Post subject:  Yay C++

Code:
#include <iostream>

void main() {
   const int iAmountOfArrays(200);
   int iaByteArray[iAmountOfArrays];
   int iCurrentLoop(0);
   int iSearchArray;
   bool bValidArray;

   while (iCurrentLoop < iAmountOfArrays) {
      std::cout << "Changing Array[" << iCurrentLoop << "]" << std::endl;
      iaByteArray[iCurrentLoop] = (iCurrentLoop + 200);
      iCurrentLoop = iCurrentLoop + 1;
   }

   if (iCurrentLoop == iAmountOfArrays) {
      std::cout << "Finished modifying array" << std::endl;
      std::cout << "Would you like to search an array? 1 - " << iAmountOfArrays << std::endl;
   }

      do {
         bValidArray = true;
         std::cin >> iSearchArray;
         if (iSearchArray < 0 || iSearchArray > iAmountOfArrays) {
            bValidArray = false;
         } else {
            std::cout << "Array[" << iSearchArray << "] = " << iaByteArray[iSearchArray] << std::endl;
         }
         if (bValidArray = false) {
            std::cout << "Invalid array! Please re-enter an array (1-" << iAmountOfArrays << ")" << std::endl;
         }
      } while(bValidArray == false);
      system("PAUSE");
}


Just messing around trying to get used to the syntax.. It's actually fun to touch another language.

http://xoax.net

Author:  Acruno [ Sun Apr 12, 2009 2:29 pm ]
Post subject:  Re: Yay C++

Tony wrote:
It's actually fun to touch another language.


YOU FUCKING LIE.

Author:  Tony [ Sun Apr 12, 2009 2:33 pm ]
Post subject:  Re: Yay C++

Acruno wrote:
Tony wrote:
It's actually fun to touch another language.


YOU FUCKING LIE.


:lol: No, really. It's not like I never touched C++ before though, it's just I understand it better now.
Comparing to VB6 I just went straight off to the source.. without tutorials, books or anything that regarded
learning VB6. So I had alot of knowledge gaps, probably still do. Fresh starts are great.

Author:  Jacob [ Sun Apr 12, 2009 2:53 pm ]
Post subject:  Re: Yay C++

You can post your c++ stuff in the General section of Programmers Haven.

Author:  Tony [ Sun Apr 12, 2009 4:57 pm ]
Post subject:  Re: Yay C++

Dugor wrote:
You can post your c++ stuff in the General section of Programmers Haven.


Oh alright, just wanted to ask though.. in C++ is namespace the same as types in VB6?

Author:  Robin [ Sun Apr 12, 2009 5:49 pm ]
Post subject:  Re: Yay C++

Moved to correct section.

Author:  Dragoons Master [ Sun Apr 12, 2009 7:26 pm ]
Post subject:  Re: Yay C++

Tony wrote:
Dugor wrote:
You can post your c++ stuff in the General section of Programmers Haven.


Oh alright, just wanted to ask though.. in C++ is namespace the same as types in VB6?

No.
Namespaces:
"In general, a namespace is an abstract container providing context for the items (names, or technical terms, or words) it holds and allowing disambiguation of items having the same name (residing in different namespaces)." by Wikipedia

Types are more like structs in C/C++.

Author:  GIAKEN [ Sun Apr 12, 2009 10:09 pm ]
Post subject:  Re: Yay C++

Namespace is like class module referencing?

Author:  Lea [ Mon Apr 13, 2009 3:08 pm ]
Post subject:  Re: Yay C++

a namespace is simply an identifier to say which one you want.

It's like an additional portion to the name of a function, class, type, whatever, that can be left off if it's understood what namespace it's in (by telling the compiler)

Author:  Exadon [ Fri May 15, 2009 6:07 am ]
Post subject:  Re: Yay C++

Tony,
what compiler are you using?
Thanks.

Author:  Tony [ Fri May 15, 2009 6:35 am ]
Post subject:  Re: Yay C++

VS Express

Author:  GIAKEN [ Fri May 15, 2009 6:48 am ]
Post subject:  Re: Yay C++

I use Dev-C++ :D

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/