Added the type in to the print

This commit is contained in:
Justin 2025-05-11 10:39:58 -05:00
parent b7ad0fbb6c
commit 5855b37c6e
2 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,7 @@
#include <iostream>
#include <string>
#include <thread>
#include <cstring>
using namespace std;
class Print{
@ -12,5 +14,6 @@ class Print{
};
void printl(string text);
void println(string text);
static void type(string text);
};

View File

@ -7,3 +7,20 @@ void Print::printl(string text){
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;
}