Skip to content

Commit 84555f9

Browse files
Merge pull request #4 from kingrishabdugar/kingrishabdugar-patch-3
Create dorakit#27 Compare Paths of Two Files
2 parents 04113c9 + 9041afb commit 84555f9

File tree

1 file changed

+248
-0
lines changed

1 file changed

+248
-0
lines changed

#27 Compare Paths of Two Files

+248
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
1+
// C++ Program to Compare Paths of Two Files
2+
// Om Bhikshu Jai Bhikshu
3+
// Jai Jai JyotiCharan Jai Jai Mahashraman
4+
// Rishab Dugar
5+
#include<iostream>
6+
#include <bits/stdc++.h>
7+
using namespace std;
8+
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
9+
#define l long
10+
#define ll long long
11+
#define fr(i, a, b) for (ll i = a; i < b; i++)
12+
#define rf(i, a, b) for (ll i = a; i >= b; i--)
13+
#define ull unsigned long long
14+
#define ui unsigned int
15+
#define vi vector<int>
16+
#define vll vector<ll>
17+
#define pb push_back
18+
#define all(a) a.begin(), a.end()
19+
#define mx(a) *max_element(all(a))
20+
#define mn(a) *min_element(all(a))
21+
#define ld long double
22+
#define mp make_pair
23+
#define pii pair<int,int>
24+
#define rep(i,n) for(int i=0;i<n;i++)
25+
#define endl "\n"
26+
#define ff first
27+
#define ss second
28+
#define PI 3.141592653589793238462
29+
30+
typedef long double lld;
31+
32+
#ifndef ONLINE_JUDGE
33+
#define debug(x) cerr << #x <<" "; _print(x); cerr << endl;
34+
#else
35+
#define debug(x)
36+
#endif
37+
38+
/*********************************************************************************/
39+
40+
void _print(ll t) {cerr << t;}
41+
void _print(int t) {cerr << t;}
42+
void _print(string t) {cerr << t;}
43+
void _print(char t) {cerr << t;}
44+
void _print(lld t) {cerr << t;}
45+
void _print(double t) {cerr << t;}
46+
void _print(ull t) {cerr << t;}
47+
48+
template <class T, class V> void _print(pair <T, V> p);
49+
template <class T> void _print(vector <T> v);
50+
template <class T> void _print(set <T> v);
51+
template <class T, class V> void _print(map <T, V> v);
52+
template <class T> void _print(multiset <T> v);
53+
template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
54+
template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
55+
template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
56+
template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
57+
template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}
58+
59+
/*********************************************************************************/
60+
61+
//const int M=1e9+7;
62+
/*
63+
ll mod(ll x, ll M){
64+
return ((x%M + M)%M);
65+
}
66+
67+
ll add(ll a, ll b, ll M){
68+
return mod(mod(a,M) + mod(b,M) , M);
69+
}
70+
71+
ll mul(ll a, ll b, ll M){
72+
return mod(mod(a,M) * mod(b,M) , M);
73+
}
74+
*/
75+
76+
/*********************************************************************************/
77+
78+
#define cinstr(str) getline(cin >> ws, str)
79+
80+
// Trim trailing and leading white space
81+
82+
const std::string WHITESPACE = " \n\r\t\f\v";
83+
std::string ltrim(const std::string &s)
84+
{
85+
size_t start = s.find_first_not_of(WHITESPACE);
86+
return (start == std::string::npos) ? "" : s.substr(start);
87+
}
88+
89+
std::string rtrim(const std::string &s)
90+
{
91+
size_t end = s.find_last_not_of(WHITESPACE);
92+
return (end == std::string::npos) ? "" : s.substr(0, end + 1);
93+
}
94+
95+
std::string trim(const std::string &s) {
96+
return rtrim(ltrim(s));
97+
}
98+
99+
//int in=stoi(str)
100+
101+
/*********************************************************************************/
102+
103+
ll gcd(ll a, ll b) {
104+
return b ? gcd(b, a % b) : a;
105+
}
106+
ll lcm(ll a, ll b) {
107+
return (a / gcd(a, b)) * b;
108+
}
109+
vector < ll > sieve(int n) {
110+
int * arr = new int[n + 1]();
111+
vector < ll > vect;
112+
for (int i = 2; i <= n; i++)
113+
if (arr[i] == 0) {
114+
vect.push_back(i);
115+
for (int j = 2 * i; j <= n; j += i) arr[j] = 1;
116+
} return vect;
117+
}
118+
vector < bool > sievebool(ll n) {
119+
vector < bool > isPrime(n + 1, true);
120+
for (int i = 2; i * i <= n; i++) {
121+
if (isPrime[i]) {
122+
for (int j = i * i; j <= n; j = j + i) {
123+
isPrime[j] = false;
124+
}
125+
}
126+
}
127+
return isPrime;
128+
}
129+
bool isPowerOfTwo(ll n) {
130+
if (n == 0) {
131+
return false;
132+
}
133+
return (ceil(log2(n)) == floor(log2(n)));
134+
}
135+
void swap(int & a, int & b) {
136+
a ^= b;
137+
b ^= a;
138+
a ^= b;
139+
}
140+
long long bin_exp(long long a, long long n) {
141+
long long res = 1;
142+
while (n > 0) {
143+
if (n & 1) {
144+
res = res * a;
145+
n--;
146+
} else {
147+
a = a * a;
148+
n /= 2;
149+
}
150+
}
151+
return res;
152+
}
153+
long long mod_exp(long long a, long long n, long long mo) {
154+
long long res = 1;
155+
a %= mo;
156+
while (n > 0) {
157+
if (n & 1) {
158+
res = (res * a) % mo;
159+
n--;
160+
} else {
161+
a = (a * a) % mo;
162+
n /= 2;
163+
}
164+
}
165+
return res;
166+
}
167+
ll mod_inv(ll n, ll mo) {
168+
return mod_exp(n, mo - 2, mo);
169+
}
170+
171+
/*********************************************************************************/
172+
// nCr functions :
173+
/*
174+
vector < ll > fact(1000001, 0);
175+
void compute_fact(ll mo) {
176+
fact[0] = fact[1] = 1;
177+
for (ll i = 2; i <= 1000000; i++) {
178+
fact[i] = fact[i - 1] * i % mo;
179+
}
180+
}
181+
182+
ll nCr(ll n, ll r, ll mo) {
183+
if (r > n) return 0;
184+
if (r == 0) return 1;
185+
ll res = fact[n];
186+
res = res * (mod_inv(fact[r], mo)) % mo;
187+
res = res * (mod_inv(fact[n - r], mo)) % mo;
188+
return res;
189+
}
190+
*/
191+
192+
/*********************************************************************************/
193+
void solve()
194+
{
195+
ll n;
196+
cin>>n;
197+
}
198+
int main()
199+
{
200+
201+
#ifndef ONLINE_JUDGE
202+
freopen("Error.txt", "w", stderr);
203+
#endif
204+
ios::sync_with_stdio(0);
205+
cin.tie(0);
206+
cout.tie(0);
207+
cout<<fixed;
208+
cout<<setprecision(10);
209+
ll t=1;
210+
cin>>t;
211+
while(t--)
212+
{
213+
solve();
214+
}
215+
216+
return 0;
217+
}
218+
219+
220+
// function to compare two paths
221+
void pathCompare(string p1, string p2)
222+
{
223+
224+
// stores compared value 0 or >0 or <0
225+
const int res = p1.compare(p2);
226+
if (res > 0)
227+
cout << p1 << " is greater than " << p2;
228+
else if (res == 0)
229+
cout << p1 << " is equal to " << p2;
230+
else
231+
cout << p1 << " is less than " << p2;
232+
cout << "\n";
233+
}
234+
235+
// Driver code
236+
int main()
237+
{
238+
string p1 = "/a/b/c";
239+
string p2 = "/a/b/";
240+
string p3 = "/a/b";
241+
string p4 = "/a/b";
242+
string p5 = "/a/b";
243+
string p6 = "/a/b.";
244+
pathCompare(p1, p2); // function call
245+
pathCompare(p3, p4); // function call
246+
pathCompare(p5, p6); // function call
247+
return 0;
248+
}

0 commit comments

Comments
 (0)