this is my code error is in sort function kindly tell me how to correct it
Error in the question of fractional knapsack
while submitting it is showing runtime error
https://practice.geeksforgeeks.org/problems/fractional-knapsack/0
declare ur vector like->
vector a(n); // this will create vector of size n
also they were asking to print upto 2 decimal precision
so added cout<<fixed<<setprecision(2)<<output; // to print output upto 2 decimal
1 Like
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.