oversaette en algorithm
Hej,Jeg er meget ny i C++ og er gaaet igang med at laere algoritmer. Jeg har lidt svaert ved at oversaette en algoritme til C++ og ville hoere om der er en der kan hjaelpe mig med denne.
Input : file, list, len
Output: list, len
Local vars: buffer, position
1. Initialize len to zero
2. Read a number from the file and place it in buffer
3. As long as the file is not empty and len < MAX_LEN do the following steps
3.1. Position= find the correct position for the value stored in buffer in the list
3.2. Move the elements in the list from position to the end of list [position .. len-1] to left to make room for the new element stored in buffer
3.3. Place the value stored in buffer in list [position]
3.4. Increment the len
3.5. Read a new number from the file and place it in buffer
4. If file is still not empty print a warning that only the first MAX_LEN elements will be processed
Paa forhaand tak!
