php hit counter

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLOM IN PROGRAMMING code 2011
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
RESPECTED SIR THIS PROGRAM IS CODED IN OUR TEXT BOOK
SIR I HAD DONE THIS EXAMPLE AND TJIS EXAMPLE RUN SUCCESSFULLY
SIR ONE QUESTION RISES IN MINE MIND THAT WE HAVE DECLARED
THE SIZE OF ARRAY IS GIVEN AS 7 IT MEANS THAT ONLY SEVEN
VALUES CAN BE STORED BUT HERE WE HAD STORED ALL THE VALUES
OF THE NUMBERS GENERATED BY THE RAND FUNCTION

HOW DOES IT HAPPENED KINDLY TELL ME THAT WHAT DOES THIS
LOOP IS DOING
for (roll=1;roll<=600000;roll++)
frequency[1+rand()%6]++;
THE CODE IS SNIPPED THERE

Code:
#include<iostream.h> #include<conio.h> #include<iomanip.h> using std::setw; #include<cstdlib> using std::rand; using std::srand; #include<ctime> using std::time; main() { int roll; int face; const int arraysize=7; int frequency[arraysize]={}; for (roll=1;roll<=600000;roll++) frequency[1+rand()%6]++; cout<<"FACE"; cout<<setw(13); cout<<"FREQUENCY"; cout<<endl; for ( face=1;face<arraysize;face++) { cout<<setw(4); cout<<face; cout<<setw(13); cout<<frequency[face]; cout<<endl; } cout<<getch(); }
Reply


Messages In This Thread
PROBLOM IN PROGRAMMING code 2011 - by sana.pari - 04-24-2011, 04:42 PM
PROBLOM IN PROGRAMMING code 2011 - by Support - 04-24-2011, 04:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ASCII code is binary numbers of 0 and 1 in C++ 2012 Vuhelper 0 2,330 01-04-2012, 10:41 PM
Last Post: Vuhelper
  int x[10]; x[0]= 1; x[1]=2; if following code is executable in C++ 2012 Vuhelper 0 1,981 01-04-2012, 10:17 PM
Last Post: Vuhelper
  array project code c++ 2011 Vuhelper 0 1,328 12-10-2011, 06:32 PM
Last Post: Vuhelper
  factorial in C++ code 2011 Vuhelper 0 1,006 12-10-2011, 06:31 PM
Last Post: Vuhelper
  stack during function call in C++ 2011 Vuhelper 0 2,078 11-05-2011, 05:05 PM
Last Post: Vuhelper
  What is the Thing Queue? in c++ 2011 Vuhelper 0 1,835 11-05-2011, 05:02 PM
Last Post: Vuhelper
  ASCII to char conversion code in C++ 2011 Vuhelper 0 1,776 11-05-2011, 05:01 PM
Last Post: Vuhelper
  How to write a summation in a sequence? C++ 2011-12 Vuhelper 2 1,428 09-19-2011, 04:53 AM
Last Post: Xpert
  GetPixel problem in c++ 2011-12 Vuhelper 0 2,551 09-18-2011, 07:12 PM
Last Post: Vuhelper
  C++ with loop code 2011-12 Vuhelper 0 1,027 09-18-2011, 07:09 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support