-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcplusplus.cpp
More file actions
52 lines (44 loc) · 1.15 KB
/
cplusplus.cpp
File metadata and controls
52 lines (44 loc) · 1.15 KB
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
/*
C Plus PLus file by MushroomEnder!
Put header data in the header file please!
*/
#include "cplusplus.h"
int main()
{
std::cout << "Hello World from c++!" << std::endl;
std::cout << "Welcome to the c++ shell!";
while (true)
{
std::string x = lowerCase(input(""));
if (x == "exit" || x == "quit")
{
return 0;
}
else if (findInString(x, "snuggles") || findInString(x, "snuggle") || findInString(x, "cuddles") || findInString(x, "cuddle"))
{
std::cout << "C++ isn't nice enough to give snuggles";
}
else
{
std::cout << "Sorry, I don't understand :/";
}
}
}
std::string input(std::string text)
{
std::string answer;
std::cout << text << std::endl;
std::cout << ">>> ";
std::getline(std::cin, answer);
return answer;
}
std::string lowerCase(std::string text)
{
std::transform(text.begin(), text.end(), text.begin(),
[](unsigned char c){ return std::tolower(c); });
return text;
}
bool findInString(std::string string, std::string substring)
{
return string.find(substring)!=std::string::npos;
}