Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions