User:Login1994

[1]userpage of login1994.

About login1994

Username "login1994", has been a frequent used name that people use online. Not only does it hide personal information about the particular user, it is also easy to remember. And with this username, i have used it in many different sites. At times, it does not allow you to register becuase the name is preowned by other user. In this case, '1994' has been reduced to '1993', or vice versa, untill the name executes successfully.

Purpose of this article

This article has been created to accomplish the first exercise of BCA 11 (Business Web Communication 11) in Point Grey Secondary School. For more information about the exercise, or the course, link:Wiki assignment page.

Previously made program

A previous assignment done with wikispaces: CPlusPlusCrap It is a wiki about c++ programming. It is where we upload and discuss code that we wrote in IT12. Indeed a very useful site for C++ learning, and for people who just started learning to program.

Random Seed

srand function, is used to seed the value of random function. This is important to prevent same random number to be produced everytime the program is executed.

prototype: void srand(unsignec seed);

in order to generate a random value, the function itself requires a seed. For example srand(1), uses the value 1 to initialize its seed. the most common seed is time. To obtain the system time value, time function is required, and its return value will range from 00:00:00 GNT January 1 1970 to the current time, and then the format time_t will be converted by (unsigned), and its value will then return to the seed itself: srand((unsigned)time(&t))

another way of generating a random number: srand((unsigned) time(&t)), where a null value has been sent to the time function. It does not require the declaration of the time class: time_t t;.

#include <stdlib.h> 
#include <stdio.h>   
#include <time.h> 
#define MAX 10  
int main(void){
 int number[MAX] = {0}; 
 int i;
 unsigned int seed; 
 scanf("%d",&seed) //manually enter seed value
 srand(seed);  
 number[i] = rand() % 100; 
 printf("%d ", number[i]);
 return 0;  

}


References

[1]

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.