Commit 21b49692 authored by DIPTYAROOP MAJI's avatar DIPTYAROOP MAJI

update usage in main.cpp

parent 117b9e95
#include <iostream> #include <iostream>
#include<stdio.h>
#include <vector> #include <vector>
#include "sorting.h" #include "sorting.h"
...@@ -7,15 +8,20 @@ using namespace std; ...@@ -7,15 +8,20 @@ using namespace std;
int main(int argc, char const *argv[]) //main function int main(int argc, char const *argv[]) //main function
{ {
vector<int> a; vector<int> a;
int s,e;
int num = 0; int num = 0;
printf("Enter start & end index : ");
scanf("%d %d", &s, &e);
while (num != -1) while (num != -1)
{ {
std::cin>>num; std::cin>>num;
if (num != -1) if (num != -1)
a.push_back(num); a.push_back(num);
} }
a = sort_custom(a); vector<int> tmp = sort_custom(a,s,e);
for(int i=s;i<e;i++)
a[i]=tmp[i-s];
for (int i=0; i <a.size(); i++) for (int i=0; i <a.size(); i++)
{ {
cout<<a[i]<<" "; cout<<a[i]<<" ";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment