This is how I have written code for wave print row wise using vector. Please help me finding my mistake as this very code is not getting submitted.
Please note- I am able to get correct answer using array function but not using vector. Please explain in vector format. Thanks!
#include
#include
#include
using namespace std;
int main(){
int n;
cin>>n;
int m;
cin>>m;
vector<vector>v(n);
for(int i=0; i<n; i++){
cin>>v[i];
vectorb;
for(int j=0; j<m; j++){
cin>>b[j];
}
v[i]=b;
}
for(int i=0; i<v.size(); i++){
if(i%2==0){
for(int j=0; j<v.size(); j++){
cout<<v[i][j]<<", β;
}
}
else{
for(int j=v.size()-1; j>=0; jβ){
cout<<v[i][j]<<β, ";
}
}
cout<<βENDβ;
}
}