Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How can i correct the error in the snippet code below?

0 votes
asked Jul 12, 2018 by Tylen Okundi (260 points)
edited Jul 17, 2018 by Tylen Okundi
//HOW CAN I CORRECT THE EROR IN THE SNIPPET BELOW?

#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
const int maxValue=9; const int minValue=0;
int main (){
    int n,vd;
    srand(time(0));
    cout<<"Enter the number of vouchers to generate:\n";
    cin>>n;
    cout<<"Enter the number of voucher digits:"<<endl;
    cin>>vd;
    for(int x=1;x<=n; x++){
        cout<<x<<"\t";
        for(int y=sizeof(char); y<=vd; y++){
            cout<<rand()%(maxValue-minValue+1)+minValue<<endl;
            if(y%4==0)
            cout<<" ";
        }
        cout<<endl;
    }
    return 0;

}

1 Answer

+4 votes
answered Jul 13, 2018 by sambhavi devi tadi
the code is working fine
commented Jul 17, 2018 by Tylen Okundi (260 points)
Yea. Had a problem with my compiler.....have corrected it. thanks.
commented Apr 17 by Josh Icoy Rcnal (100 points)
how did you corrected it?
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...