Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- #include <conio.h>
- #include <windows.h>
- using namespace std;
- ifstream mn("menu.in");
- ifstream lipsum("lorem.in");
- char menu[11][21];
- int readmenu()
- {
- int length=0;
- char option[21];
- while(mn>>option)
- {
- strcpy(menu[length], option);
- length++;
- }
- return length;
- }
- int mainmenu(int length)
- {
- int i, cursor=0;
- char input;
- cursor=length*100;
- while(true)
- {
- system("cls");
- for(i=0; i<length; i++)
- {
- cout<<menu[i];
- if(cursor%length==i)
- cout<<" <";
- cout<<'\n';
- }
- input=getch();
- switch (input)
- {
- case 'w':
- cursor--;
- break;
- case 's':
- cursor++;
- break;
- case 13:
- return cursor%length;
- break;
- }
- }
- }
- void help()
- {
- int i=0, words, k=0;
- char help[1000][15], a='p';
- while(lipsum>>help[i])
- i++;
- words=i;
- for(k=10; k>=0; k--)
- strcpy(help[i++], " ");
- system("cls");
- while(a!=27)
- {
- if(a=='w' && k>0)
- k+=-10;
- else if(a=='s' && k+150<words)
- k+=10;
- system("cls");
- for(i=1; i<=150; i++)
- {
- cout<<help[i+k-1]<<" ";
- if(i%10==0)
- cout<<'\n';
- }
- a='x';
- a=getch();
- }
- }
- int main()
- {
- int game, length;
- length=readmenu();
- while(game!=length-1)
- {
- system("cls");
- game=mainmenu(length);
- switch (game)
- {
- case 0:
- help();
- /*
- break;
- case 1:
- break;
- case 2:
- break;*/
- default:
- ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement