Boolean Array

Hi guys: Can any one please tell me if this is the right way to create a boolean array in C++ ? Thanks.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't see the code.
mustish1Author Commented:
it just keep giving me this error when i try to post the code

All tags must have a closing tag.

there is no itag in the code
If you have, for example, bracket i bracket, then that is a symbol for italics. Put the code in a code block.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mustish1Author Commented:
#include <iostream>
using namespace test;

int main()

	bool answers[3] [5] = {};
	int i = 0,   j = 000;
	answers[0][0] = 'True';
	answers[0][1] = 'True';
	answers[0][2] = 'True';
	answers[0][3] = 'True';
	answers[0][4] = 'True';

	answers[1][0] = 'True';
	answers[1][1] = 'True';
	answers[1][2] = 'True';
	answers[1][3] = 'True';
	answers[1][4] = 'True';

	answers[2][0] = 'True';
	answers[2][1] = 'True';
	answers[2][2] = 'True';
	answers[2][3] = 'True';
	answers[2][4] = 'True';
        while(i < 3)  
            cout << answers[i][j] << endl;
		i = 0;
        cout << endl;
    }	while(j < 5);

	return 0;

Open in new window

'True' is not valid. A tick (') can used for a single char literal. Replacing with "True" does provide a character literal, but that is not valid when assigning to a bool type. This is valid:
answers[0][0] = true;

Open in new window

When initializing all the bools to true, I would use two for-loops. When printing out the values, I would replace the do-while and while-loops with two for-loops.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mustish1Author Commented:
It works. Thanks.
You're welcome.  I meant to say:
Replacing with "True" does provide a character literal string, but ...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.