// You are using GCC #include using namespace std; int main() { int capacity,items,cur_weight,item; int used[10]; float profit; int i; int weight[10]; int value[10]; cout<<"Enter the capacity of knapsack:"<>capacity; cout<<"Enter the number of items:"<>items; cout<<"Enter the weight and value of "<>weight[i]; cin>>value[i]; } for(i=0;i0) { item = -1; for(i=0;i (float) value[item] / weight[item]))) item = i; used[item] = 1; cur_weight -= weight[item]; profit += value[item]; if(cur_weight >= 0) cout<