+ 1

Why "No output" !?

Hi , can u plz help me out to find out why my code prints "No output" ? I guess the while loops do not terminate.. but the reason is not really obvious to me . Plz let me know that . https://pastebin.ubuntu.com/p/NBM6cPcy9D/

4th Apr 2021, 7:00 AM
Ali_combination
Ali_combination - avatar
5 odpowiedzi
+ 2
Your condition of the while loop will never be false as you are neither changing the value of *t* not the value of a[t-1] inside the loop,which will make it an infinite loop. The reason nothing is being printed on the console is because your program is hitting time limit before getting out of the loop.
4th Apr 2021, 7:14 AM
Arsenic
Arsenic - avatar
+ 2
Arsenic thanks ! I expected that as number is being increased , a number will be replaced instead of at-1 , while it wont ! Cuz it is all adding new values to my vector ...
4th Apr 2021, 7:18 AM
Ali_combination
Ali_combination - avatar
+ 1
A.S. hmm..no thats not the bug . bits/stdc++.h includes all libraries .
4th Apr 2021, 7:08 AM
Ali_combination
Ali_combination - avatar
+ 1
No really syntax error , but i cout<<a[t-1] , and nothing is printed . There must be something wrong..
4th Apr 2021, 7:11 AM
Ali_combination
Ali_combination - avatar
- 1
Actually your code not showing any syntex error or warnings what output u expecting
4th Apr 2021, 7:10 AM
A S Raghuvanshi
A S Raghuvanshi - avatar