Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am trying to convert this c++ programming into C. Please help me with this. I am also confuse on namespace in c and how
I am trying to convert this c++ programming into C. Please help me with this. I am also confuse on namespace in c and how does that applies to main function.
#include
namespace rand_mgr {
const unsigned int a = 48271;
const unsigned int m = 0x7fffffff;
typedef struct {
unsigned int seed;
} generator;
generator* create() { generator* g = new generator;
g->seed = time(0); return g;
} void set_seed(generator* g, unsigned int s) {
g->seed = s;
}
unsigned int rand_int(generator* g) {
return g->seed = (a * g->seed) % m; }
}
Thank you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started