0

How to fix “looks like your program needs input” ??

11th Nov 2022, 8:52 PM
Aymen
Aymen - avatar
8 odpowiedzi
+ 2
/*Trs Less You are using void main() but it should be int main() { system("pouse") dont work here.remove it. add headers in separate lines. Next your program need 3 inputs height, width, symbol so add 3 values in pop-up line by line, here space separated also works.. Sample input : 2 5 + Output you see is : Height:Width:Symbol: + + + + + + + + + + And what in supposed to do with that window in this code */ // modified code to work correctly: #include <iostream> #include <iomanip> using namespace std; int main() { int height, width; cout << "Height:\n"; cin >> height; cout << "Width:\n"; cin >> width; char symbol; cout << "Symbol:\n"; cin >> symbol; for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { cout << setw(3) << symbol; } cout << endl; } //system("pause>0"); } // input sample: 5 5 * // you can see clear output now.
12th Nov 2022, 8:35 AM
Jayakrishna 🇮🇳
+ 2
If you can add a code here, we might have more of an idea. Have you tried giving an input?
11th Nov 2022, 8:55 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
That's a pop-up window asking the inputs required.. *And* In SL, you need to provide all required input by a program in the pop-up window by line by line ( or space separated if works) at running before hand.. example, in your program, enter a number in widow and hit submit. observe output...
11th Nov 2022, 9:23 PM
Jayakrishna 🇮🇳
+ 2
You enter each input on a new line 180 //(height) 76 //(weight) ^ //(symbol) Hit submit
11th Nov 2022, 9:49 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
That is my code #include<iostream> using namespace std; int main() { int n; cout<<"Enter Number :"; cin>>n; if (n>100){ cout‹<"Number is greater than 100 ."; } else { cout<<"Number is smaller than 100 ."; } return 0; } And when i try to run the code it says looks like your program needs input
11th Nov 2022, 8:59 PM
Aymen
Aymen - avatar
+ 1
Jayakrishna🇮🇳 Tysm broo you saved me💕💕💕
12th Nov 2022, 8:49 AM
Aymen
Aymen - avatar
0
And what in supposed to do with that window in this code #include <iostream> #include<iomanip> using namespace std; void main() { int height, width; cout << "Height:"; cin >> height; cout << "Width: "; cin >> width; char symbol; cout << "Symbol: "; cin >> symbol; for (int h = 0; h < height; h++) { for (int w = 0; w < width; w++) { cout << setw(3) << symbol; } cout << endl; } system("pause>0"); }
11th Nov 2022, 9:38 PM
Aymen
Aymen - avatar
0
Same thing bro it’s not running properly :/
11th Nov 2022, 9:54 PM
Aymen
Aymen - avatar