Mirage Source

Free ORPG making software.
It is currently Fri Apr 19, 2024 10:06 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Yay C++
PostPosted: Sun Apr 12, 2009 2:27 pm 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
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

_________________
Image


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Sun Apr 12, 2009 2:29 pm 
Offline
Knowledgeable

Joined: Thu Nov 22, 2007 2:59 pm
Posts: 143
Location: London, England
Google Talk: aeronjl+mirage@googlemail.com
Tony wrote:
It's actually fun to touch another language.


YOU FUCKING LIE.


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Sun Apr 12, 2009 2:33 pm 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
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.

_________________
Image


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Sun Apr 12, 2009 2:53 pm 
Offline
Pro
User avatar

Joined: Tue Nov 13, 2007 2:42 pm
Posts: 509
You can post your c++ stuff in the General section of Programmers Haven.


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Sun Apr 12, 2009 4:57 pm 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
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?

_________________
Image


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Sun Apr 12, 2009 5:49 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Moved to correct section.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Sun Apr 12, 2009 7:26 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
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++.

_________________
http://www.blackages.com.br
Image
Dave wrote:
GameBoy wrote:
www.FreeMoney.com
I admit I clicked. I immediately closed upon realizing there was, in fact, no free money.
Robin wrote:
I love you and your computer.Marry me.


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Sun Apr 12, 2009 10:09 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
Namespace is like class module referencing?

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Mon Apr 13, 2009 3:08 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
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)

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Fri May 15, 2009 6:07 am 
Offline
Regular
User avatar

Joined: Thu Aug 28, 2008 7:55 pm
Posts: 62
Tony,
what compiler are you using?
Thanks.


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Fri May 15, 2009 6:35 am 
Offline
Persistant Poster
User avatar

Joined: Wed Nov 29, 2006 11:25 pm
Posts: 860
Location: Ayer
VS Express

_________________
Image


Top
 Profile  
 
 Post subject: Re: Yay C++
PostPosted: Fri May 15, 2009 6:48 am 
Offline
Persistant Poster
User avatar

Joined: Thu Mar 29, 2007 10:30 pm
Posts: 1510
Location: Virginia, USA
Google Talk: hpmccloud@gmail.com
I use Dev-C++ :D

_________________
Nean wrote:
Yes harold. Give it to me.

Image
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group