Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <windows.h>
- #include "functions_bridge.h"
- int main ()
- {
- int i;
- char i_char[10];
- CreateDirectory("D:\\BD_bridge", NULL);
- FILE *file;
- char* file_name = "D:\\BD_bridge\db_bridge.dat";
- file = fopen (file_name, "rb");
- if(file == NULL)
- {
- file = fopen(file_name, "w+b" );
- }
- else
- {
- std::cout<<" Database file exists, create new?"<<endl<<" 1 - Yes"<<endl<<" 2 - No"<<endl;
- std::cin>>i;
- if (i==1)
- {
- char* str = ".dat";
- char file_name2 [50] = "D:\\BD_bridge\db_bridge";
- std::cout<<" Select the number of new database"<<endl;
- std::cin>>i;
- strcat(file_name2, itoa(i, i_char, 10));
- strcat(file_name2, str);
- file_name = file_name2;
- file = fopen(file_name, "w+b" );
- }
- }
- fclose (file);
- i = 1;
- while (i != 5)
- {
- std::cout<<endl<<" Menu:"<<endl;
- std::cout<<" 1 - Creat"<<endl<<" 2 - Review"<<endl<<" 3 - Sorting"<<endl<<" 4 - Search"<<endl<<" 5 - Exit"<<endl;
- std::cin>>i;
- switch (i)
- {
- case 1: Create (file, file_name); break;
- case 2: Review (file, file_name); break;
- case 3: Sorting (file, file_name); break;
- case 4: Search (file, file_name); break;
- case 5: std::cout<<endl<<" The End! :) "<<endl; break;
- }
- }
- std::cin.sync();
- std::cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement