-
Notifications
You must be signed in to change notification settings - Fork 0
/
cp.cpp
74 lines (55 loc) · 1.18 KB
/
cp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* C++ File Runner with royastik27 (Windows)
* AUTHOR: Astik Roy
**/
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
#define DOTSIZE 61
void printArt()
{
string company = "royastik27 Software Corporation";
cout << "\t\t" << company << '\n';
for(int i = 0; i < DOTSIZE; ++i)
cout << '.';
cout << '\n';
return;
}
void printEnd()
{
for(int i = 0; i < DOTSIZE; ++i)
cout << '.';
cout << "\n\t\t\tHappy Coding\n";
}
int main(int argc, char * argv[])
{
printArt();
if(argc == 1)
{
cout << "Hey! No input file.\n";
return 0;
}
char * op = argv[1], * fileName;
if(!strcmp(op, "c"))
{
if(argc == 2)
{
cout << "Hey! No input file.\n";
printEnd();
return 0;
}
fileName = argv[2];
char command[100] = "g++ -std=c++0x ";
strcat(command, fileName);
strcat(command, ".cpp -o ");
strcat(command, fileName);
// COMPILING THE FILE
system(command);
}
else fileName = op;
// EXECUTING THE FILE
system(fileName);
printEnd();
return 0;
}