I have done most of languages, I did arrays[] to all of them and of cause except COBOL, I can declare them(arrayz[]) yes that one is easy, but manipulating them thats where the problem starts, I never get any program right if I have to use arrays, Im not gona lie, I just have an idea of arrayz but I dont know how they work, and I cant understand them, if u know of any help please do share it with me

I dont know how to manipulate them, storing or getting data from them it gets worse when I have to print the data from them......... even if using either of...... for loops, while loops, do loops, if...else if... else statements

Post one such program where you used an array and it didnt work. we'll try and help you find the mistakes.

array is easy. you declare them statically like, int a[10] for an array to store ten integers.
Accessing them are simple:
a[0] = the first item
a[1] = second item
a[9] = the last item

*be careful of the array bounds as you might access item that is out of bound

//This program sucks

Here I had to do,
1. The user choose 1 of the option to buy flowers (i.e) if the user enter "1", the statement "Ur selection is Floral dreams must appear then the user must enter a quantity and so forth, but the user can have many selection as he/she wants but only the selection within the menu, although I didnt use the menu coz I didnt know how it works and my lecture is too strict when it comes to demonstrating the project, his slogan is "U better get it all wrong than copying it or writting something that u dont understand coz U gona get 0 if u cant explain what u did or u have copied it"

2. After the user make all the selection and decide to end the project, I had to store all the users selections on those arrays and calculate the price * quantity, and at the end of the project I had to print the data that I stored to the arrays just to inform the user that U have purchase the ff flowers with this quantity and the total is and what the user needs to pay for the flowers,

I hope u will understand where I come from,

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
 using namespace std;
 
	
void main()
{
	int Quantity[6]; 
	string Description[6] = {"Floral Dreams","French Design","Classic Gardens","Country Affair","Exotic Earth","Upright Arrangement"};
	double Price[6] = {280, 190, 210, 390, 260, 260};;
	int Num;
	double price;
	int count = 1;
	//price = Price[6] * Quantity[6];  


	cout << "****** FLORIST -- EXOTIC FLOWERS ******" << endl;
	cout << endl;
	cout << "1. Floral Dreams		@ R280" << endl;
	cout << "2. French Design		@ R190" << endl;
	cout << "3. Classic Gardens		@ R210" << endl;
	cout << "4. Country Affair		@ R390" << endl;
	cout << "5. Exotic earth			@ R260" << endl;
	cout << "6. Upright Arrangement		@ R260" << endl;
	cout << "7. Exit" << endl;
	
	cout << endl;
	cout << "Please make your selection ->  ";
	cin >> Num;

	do
	{
	switch(Num)
	{
		case 1:
			cout << "Your Selection:  Floral Dreams @ R280" << endl;
			cout << "Enter Quantity:  ";
			cin >> Quantity[6];
			cout << endl;
			cout << "Please make your selection ->  ";
			cin >> Num;
			break;
		case 2:
			cout << "Your Selection:  French Design @ R190" << endl;
			cout << "Enter Quantity:  ";
			cin >> Quantity[6];
			cout << endl;
			cout << "Please make your selection ->  ";
			cin >> Num;
			break;
		case 3:
			cout << "Your Selection:  Classic Gardens @ R210" << endl;
			cout << "Enter Quantity:  ";
			cin >> Quantity[12];
			cout << endl;
			cout << "Please make your selection ->  ";
			cin >> Num;
			break;
		case 4:
			cout << "Your Selection:  Country Affair @ R390" << endl;
			cout << "Enter Quantity:  ";
			cin >> Quantity[6];
			cout << endl;
			cout << "Please make your selection ->  ";
			cin >> Num;
			break;
		case 5:
			cout << "Your Selection:  Exotic earth @ R260" << endl;
			cout << "Enter Quantity:  ";
			cin >> Quantity[6];
			cout << endl;
			cout << "Please make your selection ->  ";
			cin >> Num;
			break;
		case 6:
			cout << "Your Selection:  Upright Arrangement @ R260" << endl;
			cout << "Enter Quantity:  ";
			cin >> Quantity[6];
			cout << endl;
			cout << "Please make your selection ->  ";
			cin >> Num;
			break;
		case 7:
				cout << "U have Purchase the following items....." << endl;
				cout << endl;
				cout << "#  Description" << "\t" << "\t" << "Quant" << "\t" << "Total" << endl;
				cout << endl;
				for(int x = 0; x <= 6; x++)
				{
					if(Quantity[x] != 0)
					{
						cout << count << " " << Description[x] << "\t" << "\t" << Quantity[6]<< "\t" 
						<< Price[x] << endl;
						count++;
					}
				}
				
				break;

		default: cout << "The selection you made is invalid" << endl;
	}
	}while (Num != 8);
}

It was gona be much more easier if it was only that, the declaration and the bounds, but I have to manipulate them using those repetition functions

Thanx a lot man anyway, I really appreciate ur time and ur concern

>> "U better get it all wrong than copying it or writting something that u dont understand coz U gona get 0 if u cant explain what u did or u have copied it"
Good for your instructor :) :) I'm not about to rewrite your program for you because I don't want you to get a 0 one the paper. Its better that there are a few errors in the program than to make it look like you didn't write it.

line 10: you need to initialize the array to 0 like this: int quantity[6] = {0}; line 40: This is where you seem to be having lots of problems with the array. That array has 6 elements -- the first one is number 0 and should represent the quantity of "Floral Dreams" purchased. Therefore you want to enter a value in quantity[0] like this: cin >> quantity[0]; In the next case statement it shoule be quantity[1], then in the next quantity[2], etc.

lines 12 and 14: you can't use the same variable name more than once.

lines 42 and 43: you don't need those lines at all. Just delete them and similar lines in the other cases.

line 90: this is another common error -- the array elements range from 0 to and including 5, the for loop should be for( i = 0; i < 6; i++) . Note that all you have to do in your program is replace the <= symbol with just <.

Ok....... that was really amazing and quick......why cant I have only 1-day-super-power so that I can still one piece of ur operating system(mind) coz mine had fad up.... worse Im too anxious about C++ coz I have heard that the language is too damn difficult and needs a lot of work and practise and I dont have much time for that and my lecture said we must read the textbook from cover to cover maybe 5 times but not less than that

Thanx a lot man, hope im gona have the super-power for the day

Now tell me... if u said I must delete those statements which asking the user to make a selection where am I suppose to do that..... inside do... while.... I guess but how is the program gona know that when the key "1" is pressed had to go back and prompt the user to make a selection again.......

>>needs a lot of work and practise
Yes, programming is probably the most time consuming course you will ever take, depending on how quickly you learn.

>>my lecture said we must read the textbook from cover to cover maybe 5 times but not less than that
You have a very good and competent instructor :)

Now tell me... if u said I must delete those statements which asking the user to make a selection where am I suppose to do that..... inside do... while.... I guess but how is the program gona know that when the key "1" is pressed had to go back and prompt the user to make a selection

Move lines 30 and 31 down a bit to inside the do loop, immediately after line 34.

To give you a brief idea. When you allocate an array you are actually reserving some memory for storing data. now lets c

when you say

int Quantity[6]; you have reserved memory to store 6 int data type. This memory is allocated serially one after the other. so you can imagine it to be 6 blocks-each capable of holding an 'int'-placed one after another.

not how do you access each of these blocks? luckily for you have numbers assigned to each of them(for now you can take it this way, once you learn pointers you'll see exactly how it works) so you have 0 for the first block, 1 for the second block and so on. Thus to either extract the data from a particular location or to insert data into a particular location all you need to do is, go to that memory location using it's number. Quantity[0] for 1st location. now its easy, you can go to any location, get data/put data do whatever you want to :) ...

Note: this was just to get you imagining on the lines. now you can read furthur to get the nitty gritty... you might start enjoying c++

Just pointing out the fact that in C/C++, array indexes are zero-based.
A simple example

#define NUM_ELEMENTS 3
int Quantity[NUM_ELEMENTS];  // An array of three integers

// Assign a value to each element
Quantity[0] = 123;
Quantity[1] = 456;
Quantity[2] = 789;

// Now, to output all elements, last valid index is 
// (NUM_ELEMENTS - 1) instead of NUM_ELEMENTS, so ..
for(int nn = 0; nn [B]<[/B] NUM_ELEMENTS; ++nn)
{
     cout << "value at[" << nn << "] = " << Quantity[nn] << "\n";
}

Guys I wish I had known of this site before, Im pretty much sure that I wud have get distinction to all my programming languages that I have done really instead of being pushed thru.... U know what I mean....... I think Im loving this simple because of ur willingness to help......

The word "Thank you" is just insufficient to describe my greatfulness.....

Thanx a lot guys really, I think I shud mark that as solved.

Ancient Dragon..... I am new to this site and wud love to know how do u write the program to appear as like..... U know what I mean,

Ancient Dragon..... I am new to this site and wud love to know how do u write the program to appear as like..... U know what I mean,

I'm afraid I don't know what you mean. appear as like what ? Do you mean the line numbers I added to your original post?

[code=cplusplus] // put your code here

[/code]

This question has already been answered. Start a new discussion instead.