Just asking for guidance

Your goal is to implement an application that reads a file, modify its content, and writes the modification back to the same file. The file includes 3 lines of integers. The first line indicates the number of integers on the third line. The second line indicates which integer on the third line has been selected (active). And the third line lists all the integers (maximum of 10). Your application should have a menu that is constantly displayed on the screen (see the menu section below). Right below the menu, the program should display list of all integers in the file (third line). Also it should show which integer is currently selected (active). The user should be able to select a menu item by entering its associated number or by pressing one of the indicated extended keys on the keyboard. “Insert” will insert an integer before the selected integer and makes the newly inserted integer active. The integer is typed by the user. If the list is full, insertion will not be possible. “Delete” deletes the active integer.
“Sort” sorts the list in ascending order. The active integer after the sort is same as the active
integer before the sort. “Select” selects the next integer in the list. If the last integer is selected, this option selects the first item in the list. “Move right” moves the selected integer one position to the right. If the last integer is selected, moving right will not be possible. “Move left” moves the selected integer one position to the left. If the first integer is selected, moving left will not be possible. “Exit” ends the application.Make sure to use the top-down design to break your program to many simpler tasks (at least one function per task) Do not use global variables. Make sure to check the special cases. Your program should save the content of the file into an array, modify the array, and write back the content of the array into the file. Make sure to test your program completely before submission. Do not forget to add comments. Submit your well-documented C++ program via Canvas.
Menu:
1.Insert "Insert" key
2.Delete "Delete" key
3.Sort "F2" key
4.Select "Down Arrow" key
5.Move Right "Right Arrow" key
6.Move Left "Left Arrow" key
7.Exit "F1" key

Code that I have so far
//written by:
//assignment:
//class:
//Date:
//description:

#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
void menus();
//displays the menu for the user.
void readFile(ifstream infile);
//going to read from the file.
void shiftLeft();
//shifts the array left.
void shiftright();
//shifts the array right.
void arrayList();
//
int main()
{


}
void menus()
{
cout << "Menus:\n"
<< "1.)Insert ""Insert"" key\n"
<< "2.)Delete ""Delete"" key\n"
<< "3.)Sort ""F2"" key\n"
<< "4.)Select ""Down Arrow"" key\n"
<< "5.)Move Right ""Right Arrow"" key\n"
<< "6.)Move Left ""Left Arrow""key\n"
<< "7.)Exit ""F1 key"" key\n";

}
void shiftright(int arrays[], int size)
{
int temp = arrays[0];
for (int i = 0; i< (size - 1); i++)// for loop moving the array right
{
arrays[i] = arrays[i + 1];
}
arrays[size - 1] = temp;

}
void shiftLeft(int arrays[], int size, int activeNum)
{
int temp = arrays[0];
for (int i = 0; i < (size -1); i++)
{
arrays[i] = arrays[i - 1];
}
arrays[size + 1] = temp;
}
void arrayList()
{
int

do
{
menus();
cin >> choice;
switch(choice |)
{
case 1:


}
}while(choice != 7)
}
I just need guidance and tips that is all. Not asking people to do my work for me.
closed account (48T7M4Gy)
I got the code you were handed to run. Now it's your turn.
Tip: don't expect much if you don't take a turn.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//assignment:
//class:
//Date:
//description:

#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
void menus();
//displays the menu for the user.
void readFile(ifstream infile);
//going to read from the file.
void shiftLeft();
//shifts the array left.
void shiftright();
//shifts the array right.
void arrayList();
//
int main()
{
    menus();
}
void menus()
{
    cout << "Menus:\n"
    << "1.)Insert ""Insert"" key\n"
    << "2.)Delete ""Delete"" key\n"
    << "3.)Sort ""F2"" key\n"
    << "4.)Select ""Down Arrow"" key\n"
    << "5.)Move Right ""Right Arrow"" key\n"
    << "6.)Move Left ""Left Arrow""key\n"
    << "7.)Exit ""F1 key"" key\n";
    
}
void shiftright(int arrays[], int size)
{
    int temp = arrays[0];
    for (int i = 0; i< (size - 1); i++)// for loop moving the array right
    {
        arrays[i] = arrays[i + 1];
    }
    arrays[size - 1] = temp;
    
}
void shiftLeft(int arrays[], int size, int activeNum)
{
    int temp = arrays[0];
    for (int i = 0; i < (size -1); i++)
    {
        arrays[i] = arrays[i - 1];
    }
    arrays[size + 1] = temp;
}
void arrayList()
{
    int choice;
    
    do
    {
        menus();
        cin >> choice;
        switch(choice)
        {
            case 1:
                break;
                
                
        }
    }while(choice != 7);
}
Last edited on
Topic archived. No new replies allowed.