shot-gun-pete/src/print.cpp

27 lines
499 B
C++

#include "include/print.h"
void Print::printl(string text){
cout << text << flush;
}
void Print::println(string text){
cout << text << endl;
}
void Print::type(string text){
int a = text.size();
char* charArray = new char[a+1];
strcpy(charArray, text.c_str());
int i = 0;
int time = 300;
while(i < a+1){
std::this_thread::sleep_for(std::chrono::milliseconds(time));
cout << charArray[i] << flush;
i++;
}
cout << endl;
delete[] charArray;
}