Hi,
I can't seem to figure out why this doesn't take input:
#include <iostream> #include <conio.h> #include <string> #include <vector> using namespace std; int main() { int number_of_tasks; cout << "Enter the number of tasks: "; cin >> number_of_tasks; std::string* tasks = new std::string[number_of_tasks]; for(int i = 0; i < number_of_tasks; ++i) { cout << "Give a name to task " << i + 1 << ": "; std::getline(std::cin, tasks[i]); cout << "Enter deadline: ";
The above is part of the code. But here is a sample output:
Enter the number of tasks: 3
Give a name to task 1: Enter deadline:
What's wrong with my code?