Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "int_buffer.h"
- #include "int_sorted.h"
- #include <iostream>
- #include <string>
- void f(int_buffer buf){
- int j = 1;
- for (int *i = buf.begin(); i != buf.end(); i++)
- {
- *i = j++;
- }
- const int_buffer &btmp=buf; // const object to call correct begin & end.
- for (const int *i = btmp.begin(); i != btmp.end(); i++)
- {
- std::cout << *i << std::endl;
- }
- }
- void g(int_sorted buf){
- for (size_t i = 0; i < 10; i++){
- std::cout << "Position: " << buf.insert(i*191) << std::endl;
- }
- const int_sorted &btmp=buf; // const object to call correct begin & end.
- for (const int *i = btmp.begin(); i != btmp.end(); i++)
- {
- std::cout << *i << std::endl;
- }
- }
- int main(int argc, char const *argv[])
- {
- std::string choice, file;
- std::cout << "\t -:: Welcome to MarcuS merge program::-" << std::endl;
- while (true){ // Simple user interface
- std::cout
- << "Choose option" << std::endl
- << "[1] -\t int_buffer" << std::endl
- << "[2] -\t int_sorted - insert" << std::endl
- << "[3] -\t Testing 1 and 2" << std::endl
- << "[4] -\t Exit program" << std::endl;
- std::getline(std::cin, choice);
- std::cout << std::endl;
- //Choice 1
- if (choice.find('1') != std::string::npos){
- int_buffer buf(10);
- f(buf);
- //Choice 2
- }else if(choice.find('2') != std::string::npos){
- int_sorted buf(0, 0);
- g(buf);
- //Choice 3
- }else if (choice.find('3') != std::string::npos){
- std::cout << "woopwoop\n";
- //Choice 4
- }else if(choice.find('4') != std::string::npos){
- return 0;
- //Incorrect input
- }else{
- std::cout << "Please choose between [1], [2], [3] and [4]." << std::endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment