About Array C++

e
Last edited on
Here is a better way to quit something:

1
2
3
4
5
6
7
8
9
bool Quit = false;

while (!Quit) {
//your code here

//user wants to quit
Quit = true;
}


This avoids the infinite loop, which is a bad idea for beginners. There are valid situations for infinite loops, but this is not one of them.

To create a menu, use a switch statement. Look in the documentation / reference section at the top left of this page, to read all about it.

HTH
I was going to say what the ideasman said. And also what is true?

while(true) can mean a LOT of things. Say if you wanted to place a<b?

also it looks like you are going to need to make some functions for certian names. like a delete name, re-name etc.

also I agree it's better to do it as an array. and if you are going to do a sort techinique may I suggest bubblesort? easiest way of remembering sort techniqes if you ask me ha-ha.


Also matters on the size of array. if you say you have 9999999 names quicksort is AWSOME while 10 is pretty quick with select sort.

SO many things that can be done just to what you asked for. Please verify what you are having problems with.

Now just for some help Arrays are a set of characters under one roof. Say x.
X can have any number of defenitions just like in algebra. but only one correct?

Arrays make it possible so that you can have the same name with MANY values. BE CAREFUL THOUGH if you try to say oh cout<<X; it will give you the address of the array NOT the desired effect. you need to use a for loop and increment it. It takes a TON of time but it works.
Topic archived. No new replies allowed.