SlideShare a Scribd company logo
#include
#include
using namespace std;
//global variable declaration
int a[10];
int active, size;
void menu() {//prints menu
cout << "menu" << endl;
cout << "1.Insert "Insert" key" << endl; //code 45
cout << "2.Delete "Delete" key" << endl; //code 46
cout << "3.Sort "F2" key" << endl; //code 113
cout << "4.Select "Down Arrow" key" << endl; //code 40
cout << "5.Move Right "Right Arrow" key" << endl; //code 39
cout << "6.Move Left "Left Arrow" key" << endl; //code 37
cout << "7.Exit "F1" key" << endl; //code 112
cout << "press the required key or number to continue" << endl;
}
//reads the data from file
void readdata() {
ifstream f;
f.open("F://MyFile.txt");
if (f.is_open()) {
f>>size;
f>>active;
if (size > 10) {
cout << "Numbers exceeds array limit";
return;
} else {
for (int i = 0; i < size; i++) {
f >> a[i];
}
}
f.close();
}
}
//sorts the data
void sort() {
//sorting using bubble sort
int pass = 0, so = 0, t, i;
while ((pass <= size - 1) && (so == 0)) {
so = 1;
for (i = 0; i < size - 1 - pass; i++) {
if (a[i] > a[i + 1]) {
t = a[i];
a[i] = a[i + 1];
a[i + 1] = t;
so = 0;
}
}
pass = pass + 1;
}
}
//prints the data
void print() {
cout<<" ";
for (int i = 0; i < size; i++) {
cout << a[i] << "t";
}
cout << "Active=" << active << endl;
}
//writes the data into the file
void writedata() {
ofstream f;
f.open("F://MyFile.txt");
f << size << endl;
f << active << endl;
for (int i = 0; i < size; i++) {
f << a[i] << " ";
}
f.close();
}
//inserts an element in array and makes it active
void insert() {
if (size == 10)//checks if the list is full
cout << "list is full";
else {
int x, i;
cout << "Enter a number to insert: ";//takes user input
cin>>x;
for (i = 0; i < size; i++) {
if (a[i] == active)//finds active index
break;
}
size++;//increment the size
int y = size;
while (y != i) {//shifting
a[y] = a[y - 1];
y--;
}
a[i] = x;//insert
active = x;//sets active
}
}
//deletes the active value and sets the next one as active
void del() {
int i;
for (i = 0; i < size; i++) {//finds active index
if (a[i] == active)
break;
}
active = a[i + 1]; //sets the next one as active
while (i < size - 1) {//shifting
a[i] = a[i + 1];
i++;
}
size--;//decrements the size
}
//changes the active value
void select() {
int i;
for (i = 0; i < size; i++) {
if (a[i] == active)//finds active index
break;
}
if (i == size - 1)
active = a[0]; //selects the first one as active
else
active = a[i + 1]; //sets the next one as active
}
//moves the active value to its left
void moveleft() {
int i;
for (i = 0; i < size; i++) {
if (a[i] == active)
break;
}
if (i == 0)
cout << "moving left is not possible"; //selects the first one as active
else
{ int temp = a[i - 1];
a[i-1]=a[i];
a[i]=temp;
//moves the active value to the left of the previous element by swapping
}
}
//moves the active value to its right
void moveright() {
int i;
for (i = 0; i < size; i++) {
if (a[i] == active)
break;
}
if (i == size - 1)
cout << "moving right is not possible"; //selects the first one as active
else
{ int temp = a[i + 1];
a[i+1]=a[i];
a[i]=temp;
//moves the active value to the right of the next element by swapping
}
}
int main() {
int ch;
readdata();
print();
menu();
while (1) {
// switch (getchar()) {//keyboard key input
// case 45:
// insert();
// print();
// break;
// case 46:
// del();
// print();
// break;
// case 113:
// sort();
// print();
// break;
// case 40:
// down();
// print();
// break;
// case 39:
// right();
// print();
// break;
// case 37:
// left();
// print();
// break;
// case 112:
// print();
// writedata();
// return 0;
// break;
// default:
// cout << "Invalid key" << endl;
// }
cin>>ch;
switch (ch) {//numeric input
case 1:
insert();
print();
break;
case 2:
del();
print();
break;
case 3:
sort();
print();
break;
case 4:
select();
print();
break;
case 5:
moveright();
print();
break;
case 6:
moveleft();
print();
break;
case 7:
print();
writedata();
return 0;
break;
default:
cout << "Invalid key" << endl;
}
menu();
}
return 0;
}
Solution
#include
#include
using namespace std;
//global variable declaration
int a[10];
int active, size;
void menu() {//prints menu
cout << "menu" << endl;
cout << "1.Insert "Insert" key" << endl; //code 45
cout << "2.Delete "Delete" key" << endl; //code 46
cout << "3.Sort "F2" key" << endl; //code 113
cout << "4.Select "Down Arrow" key" << endl; //code 40
cout << "5.Move Right "Right Arrow" key" << endl; //code 39
cout << "6.Move Left "Left Arrow" key" << endl; //code 37
cout << "7.Exit "F1" key" << endl; //code 112
cout << "press the required key or number to continue" << endl;
}
//reads the data from file
void readdata() {
ifstream f;
f.open("F://MyFile.txt");
if (f.is_open()) {
f>>size;
f>>active;
if (size > 10) {
cout << "Numbers exceeds array limit";
return;
} else {
for (int i = 0; i < size; i++) {
f >> a[i];
}
}
f.close();
}
}
//sorts the data
void sort() {
//sorting using bubble sort
int pass = 0, so = 0, t, i;
while ((pass <= size - 1) && (so == 0)) {
so = 1;
for (i = 0; i < size - 1 - pass; i++) {
if (a[i] > a[i + 1]) {
t = a[i];
a[i] = a[i + 1];
a[i + 1] = t;
so = 0;
}
}
pass = pass + 1;
}
}
//prints the data
void print() {
cout<<" ";
for (int i = 0; i < size; i++) {
cout << a[i] << "t";
}
cout << "Active=" << active << endl;
}
//writes the data into the file
void writedata() {
ofstream f;
f.open("F://MyFile.txt");
f << size << endl;
f << active << endl;
for (int i = 0; i < size; i++) {
f << a[i] << " ";
}
f.close();
}
//inserts an element in array and makes it active
void insert() {
if (size == 10)//checks if the list is full
cout << "list is full";
else {
int x, i;
cout << "Enter a number to insert: ";//takes user input
cin>>x;
for (i = 0; i < size; i++) {
if (a[i] == active)//finds active index
break;
}
size++;//increment the size
int y = size;
while (y != i) {//shifting
a[y] = a[y - 1];
y--;
}
a[i] = x;//insert
active = x;//sets active
}
}
//deletes the active value and sets the next one as active
void del() {
int i;
for (i = 0; i < size; i++) {//finds active index
if (a[i] == active)
break;
}
active = a[i + 1]; //sets the next one as active
while (i < size - 1) {//shifting
a[i] = a[i + 1];
i++;
}
size--;//decrements the size
}
//changes the active value
void select() {
int i;
for (i = 0; i < size; i++) {
if (a[i] == active)//finds active index
break;
}
if (i == size - 1)
active = a[0]; //selects the first one as active
else
active = a[i + 1]; //sets the next one as active
}
//moves the active value to its left
void moveleft() {
int i;
for (i = 0; i < size; i++) {
if (a[i] == active)
break;
}
if (i == 0)
cout << "moving left is not possible"; //selects the first one as active
else
{ int temp = a[i - 1];
a[i-1]=a[i];
a[i]=temp;
//moves the active value to the left of the previous element by swapping
}
}
//moves the active value to its right
void moveright() {
int i;
for (i = 0; i < size; i++) {
if (a[i] == active)
break;
}
if (i == size - 1)
cout << "moving right is not possible"; //selects the first one as active
else
{ int temp = a[i + 1];
a[i+1]=a[i];
a[i]=temp;
//moves the active value to the right of the next element by swapping
}
}
int main() {
int ch;
readdata();
print();
menu();
while (1) {
// switch (getchar()) {//keyboard key input
// case 45:
// insert();
// print();
// break;
// case 46:
// del();
// print();
// break;
// case 113:
// sort();
// print();
// break;
// case 40:
// down();
// print();
// break;
// case 39:
// right();
// print();
// break;
// case 37:
// left();
// print();
// break;
// case 112:
// print();
// writedata();
// return 0;
// break;
// default:
// cout << "Invalid key" << endl;
// }
cin>>ch;
switch (ch) {//numeric input
case 1:
insert();
print();
break;
case 2:
del();
print();
break;
case 3:
sort();
print();
break;
case 4:
select();
print();
break;
case 5:
moveright();
print();
break;
case 6:
moveleft();
print();
break;
case 7:
print();
writedata();
return 0;
break;
default:
cout << "Invalid key" << endl;
}
menu();
}
return 0;
}

More Related Content

DOCX
#include fstream#include iostream#include cstdlib#includ.docx
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
#include fstream#include iostream#include cstdlib#includ.docx
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf

Similar to #includeiostream #includefstreamusing namespace std; glo.pdf (20)

PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
PDF
#include algorithm #include vector #include iostream usi.pdf
DOC
CBSE Class XII Comp sc practical file
DOCX
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docx
PDF
fully comments for my program, thank you will thumb up#include io.pdf
DOCX
Assignment
DOC
Ds 2 cycle
DOCX
C++ detyrat postim_slideshare
PDF
Computer_Practicals-file.doc.pdf
PDF
#includeiostream #includecstdio #includecstdlib using na.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
#include algorithm #include vector #include iostream usi.pdf
CBSE Class XII Comp sc practical file
RightTrianglerightTriangle.cppRightTrianglerightTriangle.cpp.docx
fully comments for my program, thank you will thumb up#include io.pdf
Assignment
Ds 2 cycle
C++ detyrat postim_slideshare
Computer_Practicals-file.doc.pdf
#includeiostream #includecstdio #includecstdlib using na.pdf
Ad

More from krram1989 (17)

PDF
a)Notesb)Equity income accrual—2015 ($181,500 × 30)$54450Amorti.pdf
PDF
(1) Euclids Elements was used as the primary math textbook fro.pdf
PDF
A unicellular green alga somehow failed to separate into two daughte.pdf
PDF
5 cap and polyadenylationPost-transcriptional mRNA modification.pdf
PDF
Ethyl 4-aminobenzoate is partially soluble in water. Generally, org.pdf
PDF
12) Urethritis is the inflammation of the urethra (tube that takes u.pdf
PDF
1. Legionnaires disease is caused by Legionella pneumophila. It is.pdf
PDF
1) alkyl group, like CH3, is a better electron-releasing groupthan H.pdf
PDF
The effect of acid deposition is basically the ef.pdf
PDF
0.025L 0.75molL acid - 0.02795L 0.5 molL base used to neutrali.pdf
PDF
Amphoteric means that the substance can act as ei.pdf
PDF
Different types of Bits, bytes, and representation of information1.pdf
PDF
ArithmeticOperationsOnMatrix.javaimport java.util.Random; import.pdf
PDF
Answer- Q2-Cancer is a disease that is caused due to several fac.pdf
PDF
ans- Matthaei’s experiment, develped a system for synthesizing prote.pdf
PDF
An Assembly program to find the factorial of decimal number given by.pdf
PDF
A stone tool is, in the most general sense, any t.pdf
a)Notesb)Equity income accrual—2015 ($181,500 × 30)$54450Amorti.pdf
(1) Euclids Elements was used as the primary math textbook fro.pdf
A unicellular green alga somehow failed to separate into two daughte.pdf
5 cap and polyadenylationPost-transcriptional mRNA modification.pdf
Ethyl 4-aminobenzoate is partially soluble in water. Generally, org.pdf
12) Urethritis is the inflammation of the urethra (tube that takes u.pdf
1. Legionnaires disease is caused by Legionella pneumophila. It is.pdf
1) alkyl group, like CH3, is a better electron-releasing groupthan H.pdf
The effect of acid deposition is basically the ef.pdf
0.025L 0.75molL acid - 0.02795L 0.5 molL base used to neutrali.pdf
Amphoteric means that the substance can act as ei.pdf
Different types of Bits, bytes, and representation of information1.pdf
ArithmeticOperationsOnMatrix.javaimport java.util.Random; import.pdf
Answer- Q2-Cancer is a disease that is caused due to several fac.pdf
ans- Matthaei’s experiment, develped a system for synthesizing prote.pdf
An Assembly program to find the factorial of decimal number given by.pdf
A stone tool is, in the most general sense, any t.pdf
Ad

Recently uploaded (20)

PPTX
GDM (1) (1).pptx small presentation for students
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
Pharma ospi slides which help in ospi learning
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Complications of Minimal Access Surgery at WLH
PPTX
master seminar digital applications in india
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Computing-Curriculum for Schools in Ghana
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
O7-L3 Supply Chain Operations - ICLT Program
GDM (1) (1).pptx small presentation for students
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
A systematic review of self-coping strategies used by university students to ...
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Pharma ospi slides which help in ospi learning
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Complications of Minimal Access Surgery at WLH
master seminar digital applications in india
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Computing-Curriculum for Schools in Ghana
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
2.FourierTransform-ShortQuestionswithAnswers.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Microbial diseases, their pathogenesis and prophylaxis
O7-L3 Supply Chain Operations - ICLT Program

#includeiostream #includefstreamusing namespace std; glo.pdf

  • 1. #include #include using namespace std; //global variable declaration int a[10]; int active, size; void menu() {//prints menu cout << "menu" << endl; cout << "1.Insert "Insert" key" << endl; //code 45 cout << "2.Delete "Delete" key" << endl; //code 46 cout << "3.Sort "F2" key" << endl; //code 113 cout << "4.Select "Down Arrow" key" << endl; //code 40 cout << "5.Move Right "Right Arrow" key" << endl; //code 39 cout << "6.Move Left "Left Arrow" key" << endl; //code 37 cout << "7.Exit "F1" key" << endl; //code 112 cout << "press the required key or number to continue" << endl; } //reads the data from file void readdata() { ifstream f; f.open("F://MyFile.txt"); if (f.is_open()) { f>>size; f>>active; if (size > 10) { cout << "Numbers exceeds array limit"; return; } else { for (int i = 0; i < size; i++) { f >> a[i]; } } f.close(); } }
  • 2. //sorts the data void sort() { //sorting using bubble sort int pass = 0, so = 0, t, i; while ((pass <= size - 1) && (so == 0)) { so = 1; for (i = 0; i < size - 1 - pass; i++) { if (a[i] > a[i + 1]) { t = a[i]; a[i] = a[i + 1]; a[i + 1] = t; so = 0; } } pass = pass + 1; } } //prints the data void print() { cout<<" "; for (int i = 0; i < size; i++) { cout << a[i] << "t"; } cout << "Active=" << active << endl; } //writes the data into the file void writedata() { ofstream f; f.open("F://MyFile.txt"); f << size << endl; f << active << endl; for (int i = 0; i < size; i++) { f << a[i] << " "; } f.close(); }
  • 3. //inserts an element in array and makes it active void insert() { if (size == 10)//checks if the list is full cout << "list is full"; else { int x, i; cout << "Enter a number to insert: ";//takes user input cin>>x; for (i = 0; i < size; i++) { if (a[i] == active)//finds active index break; } size++;//increment the size int y = size; while (y != i) {//shifting a[y] = a[y - 1]; y--; } a[i] = x;//insert active = x;//sets active } } //deletes the active value and sets the next one as active void del() { int i; for (i = 0; i < size; i++) {//finds active index if (a[i] == active) break; } active = a[i + 1]; //sets the next one as active while (i < size - 1) {//shifting a[i] = a[i + 1]; i++; } size--;//decrements the size }
  • 4. //changes the active value void select() { int i; for (i = 0; i < size; i++) { if (a[i] == active)//finds active index break; } if (i == size - 1) active = a[0]; //selects the first one as active else active = a[i + 1]; //sets the next one as active } //moves the active value to its left void moveleft() { int i; for (i = 0; i < size; i++) { if (a[i] == active) break; } if (i == 0) cout << "moving left is not possible"; //selects the first one as active else { int temp = a[i - 1]; a[i-1]=a[i]; a[i]=temp; //moves the active value to the left of the previous element by swapping } } //moves the active value to its right void moveright() { int i; for (i = 0; i < size; i++) { if (a[i] == active) break; } if (i == size - 1)
  • 5. cout << "moving right is not possible"; //selects the first one as active else { int temp = a[i + 1]; a[i+1]=a[i]; a[i]=temp; //moves the active value to the right of the next element by swapping } } int main() { int ch; readdata(); print(); menu(); while (1) { // switch (getchar()) {//keyboard key input // case 45: // insert(); // print(); // break; // case 46: // del(); // print(); // break; // case 113: // sort(); // print(); // break; // case 40: // down(); // print(); // break; // case 39: // right(); // print(); // break; // case 37:
  • 6. // left(); // print(); // break; // case 112: // print(); // writedata(); // return 0; // break; // default: // cout << "Invalid key" << endl; // } cin>>ch; switch (ch) {//numeric input case 1: insert(); print(); break; case 2: del(); print(); break; case 3: sort(); print(); break; case 4: select(); print(); break; case 5: moveright(); print(); break; case 6: moveleft(); print();
  • 7. break; case 7: print(); writedata(); return 0; break; default: cout << "Invalid key" << endl; } menu(); } return 0; } Solution #include #include using namespace std; //global variable declaration int a[10]; int active, size; void menu() {//prints menu cout << "menu" << endl; cout << "1.Insert "Insert" key" << endl; //code 45 cout << "2.Delete "Delete" key" << endl; //code 46 cout << "3.Sort "F2" key" << endl; //code 113 cout << "4.Select "Down Arrow" key" << endl; //code 40 cout << "5.Move Right "Right Arrow" key" << endl; //code 39 cout << "6.Move Left "Left Arrow" key" << endl; //code 37 cout << "7.Exit "F1" key" << endl; //code 112 cout << "press the required key or number to continue" << endl; } //reads the data from file void readdata() { ifstream f;
  • 8. f.open("F://MyFile.txt"); if (f.is_open()) { f>>size; f>>active; if (size > 10) { cout << "Numbers exceeds array limit"; return; } else { for (int i = 0; i < size; i++) { f >> a[i]; } } f.close(); } } //sorts the data void sort() { //sorting using bubble sort int pass = 0, so = 0, t, i; while ((pass <= size - 1) && (so == 0)) { so = 1; for (i = 0; i < size - 1 - pass; i++) { if (a[i] > a[i + 1]) { t = a[i]; a[i] = a[i + 1]; a[i + 1] = t; so = 0; } } pass = pass + 1; } } //prints the data void print() { cout<<" "; for (int i = 0; i < size; i++) {
  • 9. cout << a[i] << "t"; } cout << "Active=" << active << endl; } //writes the data into the file void writedata() { ofstream f; f.open("F://MyFile.txt"); f << size << endl; f << active << endl; for (int i = 0; i < size; i++) { f << a[i] << " "; } f.close(); } //inserts an element in array and makes it active void insert() { if (size == 10)//checks if the list is full cout << "list is full"; else { int x, i; cout << "Enter a number to insert: ";//takes user input cin>>x; for (i = 0; i < size; i++) { if (a[i] == active)//finds active index break; } size++;//increment the size int y = size; while (y != i) {//shifting a[y] = a[y - 1]; y--; } a[i] = x;//insert active = x;//sets active }
  • 10. } //deletes the active value and sets the next one as active void del() { int i; for (i = 0; i < size; i++) {//finds active index if (a[i] == active) break; } active = a[i + 1]; //sets the next one as active while (i < size - 1) {//shifting a[i] = a[i + 1]; i++; } size--;//decrements the size } //changes the active value void select() { int i; for (i = 0; i < size; i++) { if (a[i] == active)//finds active index break; } if (i == size - 1) active = a[0]; //selects the first one as active else active = a[i + 1]; //sets the next one as active } //moves the active value to its left void moveleft() { int i; for (i = 0; i < size; i++) { if (a[i] == active) break; } if (i == 0) cout << "moving left is not possible"; //selects the first one as active
  • 11. else { int temp = a[i - 1]; a[i-1]=a[i]; a[i]=temp; //moves the active value to the left of the previous element by swapping } } //moves the active value to its right void moveright() { int i; for (i = 0; i < size; i++) { if (a[i] == active) break; } if (i == size - 1) cout << "moving right is not possible"; //selects the first one as active else { int temp = a[i + 1]; a[i+1]=a[i]; a[i]=temp; //moves the active value to the right of the next element by swapping } } int main() { int ch; readdata(); print(); menu(); while (1) { // switch (getchar()) {//keyboard key input // case 45: // insert(); // print(); // break; // case 46: // del();
  • 12. // print(); // break; // case 113: // sort(); // print(); // break; // case 40: // down(); // print(); // break; // case 39: // right(); // print(); // break; // case 37: // left(); // print(); // break; // case 112: // print(); // writedata(); // return 0; // break; // default: // cout << "Invalid key" << endl; // } cin>>ch; switch (ch) {//numeric input case 1: insert(); print(); break; case 2: del(); print(); break;
  • 13. case 3: sort(); print(); break; case 4: select(); print(); break; case 5: moveright(); print(); break; case 6: moveleft(); print(); break; case 7: print(); writedata(); return 0; break; default: cout << "Invalid key" << endl; } menu(); } return 0; }