Umm... Im New To c++, But Not New To Programming

Lemme Tell you All About Me Before Yu All Pile On Me!
Im Only 14!
I Can Program basic Online Codez :CSS and HTML.
I Can Also Program Visual Basic ( 3/4 of it)

My Question About C++ is Can Someone Exsplain Boolean (bool)
To Me Simply, And What Iz The Point Of A Array?
My Last Question Iz Can C++ be combined with divx to make a 3d game.

## All 6 Replies

>Lemme Tell you All About Me Before Yu All Pile On Me! Im Only 14!
You're old enough to understand the basics of proper spelling, grammar, and sentence structure.

>Can Someone Exsplain Boolean (bool)
The bool type is very simple. There are two states: true and false. Let's say you're writing code to control a light. You might use a bool variable to signal whether the light is on or off. Boolean logic isn't as simple, but it's terribly handy, and you'll need to cover at least the basics when working with logical operators in C++.

>What Iz The Point Of A Array?
It's easier to keep track of similar things when they're all collected together as opposed to separate entities.

>Can C++ be combined with divx to make a 3d game.
The answer to any "Can C++ do <xyz>?" or "Is <xyz> possible?" is almost invariably yes.

>Im New To c++, But Not New To Programming
>What Iz The Point Of A Array?

Haha! And you don't know the assets of an array?

Imagine you're a teacher and you've to write a program which deals with the pupils' scores, let's say you've twenty pupils in your classroom and you want to keep track of their scores of four tests...

In this case an array is preferred, though normal variables are possible, it's very unlikely and difficult to solve this problem, for example: you'll need 4 * 20 (= 80) variables to store all the scores...

Instead of doing it the difficult way (creating four variables for each pupil), an array is the method to solve this kind of problems.

Comparison: Solving the problem using an array - variables

1. Using variables:
``````int p1_s1; // pupil 1 score 1
int p1_s2;
int p1_s3;
int p1_s4;
int p2_s1;
int p2_s2;
int p2_s3;
.
.
.
(and so on)``````

As you can see in the above example, using variables will be very time consuming (and your code will grow in size as well)

2. Using an array:
But using an array, you only have to write a single line of code to achieve the whole thing:
``int scores[20][4]; // or int scores[4][20];``

Actually you can say that an array is a table / matrix :)
(and every separate element of the array is actually comparable to a normal variable of the same data type as the array is of)

>
>Can C++ be combined with divx to make a 3d game.
The answer to any "Can C++ do <xyz>?" or "Is <xyz> possible?" is almost invariably yes.

Except in this case as divx is a video codec. Utilising standard c++ and divx you will not make a 3D game - or more accurately whilst you could write a raytracer in C++ with no graphics hardware acceleration divx would still be useless to you.

Now thats what I call a script kiddie.

>I Can Program basic Online Codez :CSS and HTML.
You do not program in HTML. HTML is not a programming language. It is a markup language.

Consider yourself quite lucky. Because hackers don't usualy repsonz 2 sm1 who cnnt wrte pr0per1y. Plz lern englis wel it is d languazz of d int3rn3t.

As Tux4Life demonstrated, array are often given credit that they save a lot of typing work by cutting short the declaration of many variables in just one go.
But actually there is some more advantage of using an array except just to save multiple declaration.
The advantage of array lies in that each element can be called from their indexes which can be determined at the run time.
This is a bit different from what tux demonstrated.
Continuing Tux4life's example lets say you write a program which displays the marks of the student, whose roll number is entered by user. Without arrays: the program will look like this:

``````cout<<"Enter Roll Number";
int rno;
cin>>rno;
if(rno==1)
print(p1_s1,p1_s2,p1_s3,p1_s4);
if(rno==2)
print(p2_s1,p2_s2,p2_s3,p2_s4);
if(rno==3)
print(p3_s1,p3_s2,p3_s3,p3_s4);
.
.
.
//till 20 cases``````

I know the above example could have been done by using a switch case, the problem remain same.

If, however arrays are used:

``````cout<<"Enter Roll Number";
int rno;
cin>>rno;
for(int i=0;i<4;i++)
print(scores[rno][i]);
//Thats it``````

>Utilising standard c++ and divx you will not make a 3D game
That's obvious. But it's also obvious that unless the OP is a raving idiot, he didn't mean just standard C++ and DivX. There are a lot of parts to all but the most trivial of text-based games. I'm sure you can use C++ and DivX somewhere in the creation of a 3D game, so the answer to the question is still yes.

Of course, you can also be a douchebag literalist, assume the question is meant exactly as written even though it's completely nonsensical, and answer no. But who in their right mind would do that? :icon_rolleyes:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.