Let's start off with the minor:
Use code tags so we can read your code:
[code]
//Put your code here!
[/code]
|
Second, your code is.. awful. Pretty bad. There are very bad coding practices used and the code itself is an eyesore. It's poorly spaced and just a giant blob. The hanging bracket at the top is already ugly, but added to the rest makes this code unbearable to read.
Third, you are using C functions, not C++. You
DONT want to do that. C++ has alternatives to what people use in C, and they're better. If you #include <something.h> (the give away is the .h within <>), it's a C library, try to avoid.
Also, you're using C style arrays. This:
1 2 3 4
|
int a = 0;
cin >> a;
int arr[a];
| |
Is NOT valid C++. Some compilers will allow this, but this is not standard C++. You should use Vectors.
Fourth, your logic is incorrect. You frequently go beyond the bounds of your arrays. Like this piece of code will:
1 2 3 4 5 6 7
|
//Helps output all the words Problem
for (int v = (arrayLenght - 1); v >= 0; v--) {
int x = number1[v - 1];
....
// if v is 0, and you access number1[v - 1] ...
}
| |
You may not know you have - another benefit of using vectors. A vector will throw an error that clearly says you went beyond the array bounds of the vector.
With your own array, your program can "silently" crash. The program will just end and you won't know why.
To get a random number, use the <random> library, it's better in every way.