How can I get and check the user input from within the condition of a while loop?
For example, the Java equivalent would be
the first line isn't important, but anyways, I just want to know how to test the input in the while loop condition.Code:BufferedReader br = new BufferedReader (new InputStreamReader(System.in)); while (Integer.parseInt(new StringTokenizer(br.readLine()).nextToken()) != 999) do something as long as input isn't 999
I tried
but that only tests the input stream, not the actual value of a.Code:int a; while ((cin >> a) != 999)
Is there another operation other than cin >> that I can use?
Thanks.