At Thursday 2005-02-10 21:57, you wrote: >What exactly are you trying to do? Can you give a clear description? > >In your j-loop, the increment is not used anywhere! It will just give the >same output 11 times! > >You have array from total[0] to total[11]. You cannot get total[12] or >total[13]! > >I am not aware of rand() function. I believe it should be random(6) which
random(blah) is NOT standard C or C++ >gives a random number from 0 to 5. > > > >-Bharath > > > > _____ > >From: darkshadow_x21 [mailto:[EMAIL PROTECTED] >Sent: Thursday, February 10, 2005 9:10 PM >To: [email protected] >Subject: [C-Paradise] Still need help > > > > >i didn't really understand the help i got from shyan since i am >barely learning the c++ languange. all i need is to know how to >count and total up thwe values for each number: for instance if a 6 >is rolled it will count 1 for 6 and show me the percentage of >getting six after about 10 rolls or something. plz help > >#include <iostream.h> >#include <stdlib.h> >void main () >{ >randomize (); >unsigned int c,a,b; >unsigned int total[12]; >int max=13; >for (int i=1;i<=10;i++) >{ >a=rand() % 6 + 1; >b=rand() % 6 + 1; >c=a+b; >cout<<"Number rolled = "<<c<<endl; >++total[c]; >} > for (int j=2;j<=12;j++) > { > total[max]=0; > total[max]=total[c]; > cout<<j<<" "<<total[max]<<endl; > } >} > > > > > > > >-----------------------------------------~-~> >CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at >http://www.eScribe.com/software/C-Paradise/ > > >------------------------------------------_-> > > > > > > > > > >Yahoo! Groups Sponsor > > > >ADVERTISEMENT > ><http://us.ard.yahoo.com/SIG=1295avt00/M=298184.6018725.7038619.3001176/D=gr >oups/S=1705006788:HM/EXP=1108136463/A=2532114/R=2/SIG=12k6sak19/*http:/clk.a >tdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time=1108050063118813> > > ><http://view.atdmt.com/NFX/view/yhxxxnfx0020000014nfx/direct/01/&time=110805 >0063118813> > > > ><http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=groups/S= >:HM/A=2532114/rand=120783197> > > > > _____ > >Yahoo! Groups Links > >* To visit your group on the web, go to: >http://groups.yahoo.com/group/C-Paradise/ > >* To unsubscribe from this group, send an email to: >[EMAIL PROTECTED] ><mailto:[EMAIL PROTECTED]> > >* Your use of Yahoo! Groups is subject to the Yahoo! ><http://docs.yahoo.com/info/terms/> Terms of Service. > > > >[Non-text portions of this message have been removed] > > > > >-----------------------------------------~-~> >CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at >http://www.eScribe.com/software/C-Paradise/ > > >------------------------------------------_-> > > > >Yahoo! Groups Links > > > > Victor A. Wagner Jr. http://rudbek.com The five most dangerous words in the English language: "There oughta be a law" >-----------------------------------------~-~> CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at http://www.eScribe.com/software/C-Paradise/ >------------------------------------------_-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/C-Paradise/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
