Garmaine Staff asked 1 year ago

I was creating a function that takes an integer number, finds the next multiple of 5 after the number and then if the difference between the multiple and the number is less than 3, then it prints out the multiple else the number itself, finally prints out an array of all the numbers.

 #include <bits/stdc++.h>
 #include <iostream>

 using namespace std;


vector<int> gradingStudents(vector<int> grades) {
int size=grades.size();
int c=0;
int d;
vector<int> array;
for(int i=0;i<size;i++){

    while(grades[i]>(c*5)){
    c++;
    }
    d=c*5;

    if((d-grades[i])<3){
        array[i]=d;
    }else{
        array[i]=grades[i];
    }
    d=0;
    c=0;
}    
return array ;

Now I tried running this function, and the compiler gives shows no error in the program in the code, however the code doesn't print anything.

Someone Please help.