Console input during debugging in qt creator
-
wrote on 29 Jan 2014, 12:31 last edited by
When debugging a project with only one cpp file named CH2 which contains the following code:
@#include <iostream>
using namespace std;
/*function prototypes */
int combination(int n, int k);
int fact(int n);int main()
{
int n,k;
cout << "Enter the number of objects(n) : ";
cin >> n;
cout << "Enter the number to be chosen(k) : ";
cin >> k;
cout << "C(n,k) = " << combination(n,k) << endl;
return 0;
}int combination(int n, int k){
return fact(n) / (fact(k) * fact(n-k));
}int fact(int n){
int factVal = 1;
for(int i=2; i<=n ;i++)
factVal *= n;
return factVal;
}
@the debugger is asking for the input via the application output. And when I enter the input value nothing happens. Whereas running the project, a terminal window does opens up requesting for the inputs.
I have already tried changing the terminal path to xterm and a symbolic link to the openTerminal script via Preferences -> Environment -> General.
Please let me know how I can debug my code with console input.
1/1