I need some help for a program I am trying to create.

I am trying to create a program and i just cant wrap my head around it

Page 1 of 1

4 Replies - 1250 Views - Last Post: 26 September 2008 - 11:56 AM Rate Topic: -----

#1 Darkskillz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-September 08

I need some help for a program I am trying to create.

Posted 22 September 2008 - 12:27 PM

I tend to try to create hard programs. I kind of got my head in pretty deep this time though. Any help would be really appreciated. Thank you in advance.

First, I want to write a simple program that will read 5 numbers from the Console (user input). Store these values into an array of int []. Using the length of the array in a for() loop and decrementing the loop counter, write the array values in reverse order to the screen. This is step one and may be enough for partial credit.

Next, I want to add code to read 5 words from the Console (user input). Store these values into an array of string []. Make sure the string[] array is large enough to hold at least 6 values. Store the string constant “end_of_array” into the last element of the array. Using a do…while() loop, print out the 1st and 3rd letters of each word (two letters per line) using the substring function.

Finally, I want to modify the above program to read the numbers in from a text file (numbers.txt), write the values in reverse order to a second file, and read the words in from a third file, displaying the results to the Console as described above.

Is This A Good Question/Topic? 0
  • +

Replies To: I need some help for a program I am trying to create.

#2 lordms12   User is offline

  • D.I.C Regular
  • member icon

Reputation: 30
  • View blog
  • Posts: 339
  • Joined: 16-February 08

Re: I need some help for a program I am trying to create.

Posted 22 September 2008 - 12:54 PM

So what is the problem.
Was This Post Helpful? 0
  • +
  • -

#3 wartech   User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 203
  • Joined: 16-October 06

Re: I need some help for a program I am trying to create.

Posted 22 September 2008 - 02:01 PM

start with this...
//read up about arrays - google

//Create an array of ints -  example int myArray[]
//Get user input from console - cin or getline
//Find out the size of the array - google
//Create a loop based on the size of the array - google
(for int i = 0; i < size of array; i++)
{
//Your code here
}
//
Continue on...


Was This Post Helpful? 0
  • +
  • -

#4 Darkskillz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-September 08

Re: I need some help for a program I am trying to create.

Posted 22 September 2008 - 02:03 PM

View Postlordms12, on 22 Sep, 2008 - 12:54 PM, said:

So what is the problem.


I have an idea as to what I want to do, but I am having trouble coming up with the code for the program.
Was This Post Helpful? 0
  • +
  • -

#5 Darkskillz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 22-September 08

Re: I need some help for a program I am trying to create.

Posted 26 September 2008 - 11:56 AM

Thank you for the help. Ill try this and see if it helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1