Results 1 to 4 of 4

Thread: What did I do wrong in this program?

  1. #1

    What did I do wrong in this program?

    The request is pretty long:
    Consider a sequence x1, x2, ..., xn consists of n distinct positive integers. A maximum sequence number

    neighboring elements in string form xi xi 1, ..., x k-1, XK, XK 1, ..., x j (1≤i <k <j≤n) property that xi <xi 1 <. .. <xK-1 <xK> xK 1> ...> XJ, xK is called mountain top. Two mountain sequences have a common element in a row maximum. A mountain sequence has at least 3 elements. An example of a format string values ​​3 4 6 8 does not contain any sequence mountain, and one made with values ​​3 4 8 1 2 5 0 2 contains sequences mountain: 3 August 4 1 and 1 2 5 0.

    After determining all sequences mountain peaks and their sequences are deleted from the mountain tops string and continue the procedure repeated with new determination sequences mountain peaks and their new string obtained. The procedure stops when the string is no longer any sequence administration.

  2. #2

    What did I do wrong in this program?

    Entry data input file contains the first line number n, and the next line of natural numbers x1, x2, ..., xn separated two by two by one space.

    Output data

    Munte.out output file will contain the first line of a natural number as required) on the second line a natural number as required on the third line a natural number as required c).

  3. #3

    What did I do wrong in this program?

    Straight off the bat, your input is read in via input when the task says that it should be read in by a file.

    For me to go into detail you'll have to correct the second paragraph as a lot of things are culled by google translate when putting numbers into it, and go through it again and make sure it makes sense and is correct as some of the other parts are strange as well.

    I would also highly recommend just checking if this works yourself as half the job of being a programmer is to be able to write code which works, and if it doesn't you should have at least a vague idea of why it isn't or know whether it is or not. Try writing some sample data in a text file which you place sequences of numbers which should be detected as a mountain sequence and see if it picks it up.

  4. #4

    What did I do wrong in this program?

    It picks them up. I will take care of the translation when I have time, which will be soon, I hope. It picks them up. I didn't read the values from a file because it wouldn't detect "in" as a command in fstream, it only detects "out" as one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts