Trouble with code, cin not working
Compile this. Then run it. Hit 1,"enter a task."Then try to hit 1 again next time. IT won't recive input. Des anyone know why?
I apoligize in advance for being a newb.
Code:
#include <string>
#include <iostream>
#include <vector>
int tasks[40];
int num =0;
int numm =0;
int i=0;
using namespace std;
int input =0;
void taskmanager();
void main (){
taskmanager();
cout << "\nBye\n\n\n\n\n\nAll Code Copyright Patrick \n\n\nAll Rights Reserved\n";
}
void taskmanager()
{
while(num==numm)
{if(input ==0)
{
input= 7;
std::cout << "Hello \n This is your friendly task manager \n Select a command \n";
std::cout << "1) Add a task \n2) Read next on list\n3)Quit\n";
std::cin >> input;}
if ( input == 1)
{cout<< "\nOK, enter your task:\n ";
cin >> tasks[i];
i++;
input = 0;
}
if (input == 2)
if (i==0)
{cout<<"\nSorry, no items to read\n";
input = 0;
}
if (input == 2)
{ cout << "\nDO THIS:\n";
cout << tasks[(i-1)];
input = 0; }
if (input == 3)
{return;
}
}
};