English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

also a function that reverses the array in puts.example 54321 thuot put shuld be 12345

2007-09-09 05:03:57 · 4 answers · asked by Ofwono T 1 in Computers & Internet Programming & Design

4 answers

There are many that can do that, from Vbasic to C+++. Are you a programmer? You could even do that with a batch file on the command line.

2007-09-09 05:10:13 · answer #1 · answered by Dusty 7 · 0 0

When you have programs to write visualize what you need to do. Draw a picture.

You need to get input from a user and store the input in an array... so draw an array and imagine how you'll get user input and then insert the input into an array. Since your using an array, I assume there will be more than one input value- this indicates you'll probably need a loop construct.

For the second part, reversing the values in the array- again I recommend drawing the array and sketching out how each value needs to move in order to reverse the values in the array. There are many ways to accomplish this goal. Once you visualize the problem- you should be able to visualize the solution.

Being able to visualize the process is a key step in becoming a great programmer. Good luck!

2007-09-09 05:24:39 · answer #2 · answered by binary6is110 1 · 0 0

"Making the person enter" is incredibly 2 steps: a million. Asking the person for enter. 2. interpreting the enter and putting it into the subsequent fit in the array. this may well be 2 steps or a unmarried step, staring on the way you examine the enter in, the two cin >> temp; numbers[ i ] = temp; or cin >> numbers[ i ]; this means you want a loop that makes use of its index by way of fact the subscript of the array factor the present value is to pass into. On a extremely diverse be conscious, this code: const int ARRAY = 10; int a, b, c, d, e, f, g, h, j, ok; int numbers[ARRAY] = {a, b, c, d, e, f, g, h, j, ok}; would not want the a, b, c... variables. you are able to no longer call aspects in a C/C++ array (some languages you are able to). The code might desire to be this: const int ARRAY = 10; //(Or, once you're previous-college like me, #define ARRAY 10 ) (in actuality, i'm uncertain a const int could be utilized as an array length! might desire to supply you a assemble-time blunders.) int numbers[ARRAY]; Then consult with each and each factor in numbers[] with a subscript. wish that helps.

2016-12-13 04:12:18 · answer #3 · answered by ? 4 · 0 0

You mean, you want us to write you a program that does that? Well that I could do, in C++. I will just tell you about the array though.

#include
using namespace std;

int main() {
int arraySize = 50; //Change this for a different length of the array
char arrayInput[arraySize];
cin.getline(arrayInput, arraySize);

return 0;
}

That is the program in C++.

2007-09-09 05:12:02 · answer #4 · answered by Anonymous · 0 0

fedest.com, questions and answers