From 8fb0b00ec24bb772c4e3fdc39508852c3b52a198 Mon Sep 17 00:00:00 2001 From: uzma24 Date: Sun, 6 Sep 2020 11:11:44 +0530 Subject: [PATCH] Add files via upload --- Screening-Assignment/inayauzma828.cpp | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Screening-Assignment/inayauzma828.cpp diff --git a/Screening-Assignment/inayauzma828.cpp b/Screening-Assignment/inayauzma828.cpp new file mode 100644 index 0000000..9015276 --- /dev/null +++ b/Screening-Assignment/inayauzma828.cpp @@ -0,0 +1,30 @@ +//inayauzma828@gmail.com + +#include +using namespace std; +int main(){ + string arr[2000]; + ifstream file("shakespeare.txt"); + string str; + int counter = 0; + while(getline(file, str)){ + arr[counter] = line; counter++; + } + + srand(time(NULL)); + for(int i=1;i<=5;i++){ + cout << arr[rand() %10 + 1] << "\n"; + } + + string userInput; + cout << "type any sentence here: "; + time_t begin,end; + time(&begin); + getline(cin, userInput); + time(&end); + time_t duration = end-begin; + + int string_size = userInput.size(); + + cout<< "Typing Speed: " << string_size/duration << "\n"; +} \ No newline at end of file