|
C-/C++-Quelltext
|
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
|
#include <iostream>
#include <time.h>
#include <string>
using namespace std;
string command;
int main()
{
cout << "~CustomConsole v1.0 BETA by Xelvair (R)~\n " << endl;
cout << "Type 'HELP' for a list of all current commands." << endl;
while (3<5)
{
cout << endl;
cout << "con>";
getline(cin, command, '\n');
cout << endl;
if (command == "help")
{
cout << "Help Shows the overview \nQuit Quits the console \nPrint Prints a string to the console \nTime Shows the actual time \nDate Shows the actual date" << endl;
}
else if (command == "print", command == "Print", command == "PRINT")
{
string printstr;
cout << "Enter string to print: ";
getline(cin, printstr, '\n');
cout << printstr << endl;
}
else if (command == "quit", command == "Quit", command == "QUIT")
{
return 0;
}
else if (command == "time", command == "Time", command == "TIME")
{
cout <<__TIME__ << endl;
}
else if (command == "date", command == "Date", command == "DATE")
{
cout <<__DATE__ << endl;
}
else if (command == "tracesite")
{
char trace[56] = "tracert ";
char site[200];
char tracesite[256];
cout << "Enter site to trace: ";
cin >> site[200];
cout << endl;
tracesite[256] = trace[56] + site[200];
system(tracesite[256]);
}
else
{
cout << "Command couldn't be executed!" << endl;
}
}
system ("PAUSE");
return 0;
}
|
Hi Leute, ich bin schon eine Weile hier angemeldet, hab aber nochnie nen Ton von mir gegeben...bin auch ziemlich neu in C++
Jetz hab ich mir mal gedacht, machste einfach mal ein kleines Proggi welches alle sinvollen Features beinhaltet, darunter hätte ich auch gerne den CMD-Befehl "tracert <website>".
Jetzt weiß ich aber nicht, wie ich in system befehle eigene Values einbaue, oben seht ihr meinen fehlgeschlagenen Versuch^^
Ich bedanke mich schonmal im Voraus für eure Hilfe, euer Xel :)
PS: Bidde kein Fachchinesich, bin wirklich ein noob bis jetz ^^
PS2: Ich bin mir darüber im klaren, dass ich auch ein Switch-Statement hätte benutzen können, würde zu lange dauern zu erklären warum ich nestes IF's verwende ;)