Find Jobs
Hire Freelancers

Complete Program for Even/Odd Numbers

$10-30 USD

Completed
Posted over 10 years ago

$10-30 USD

Paid on delivery
Complete this program using the following declarations, the TypeString array, and the main(). enum Type{Even, Odd}; union Value { int i; double d; }; struct Number { Type type; Value value; }; const string TypeString[2] = {"even","odd"}; int main() { Number var[10]; for (int i= 0; i < 10; i++) assign(var[i]); for (int i= 0; i < 10; i++) print(var[i]); } You will need to add assign() and print() functions. The assign() function generates a random int between 1 and 100. If the int is even, it is stored in the Value union and Even in the Type. If the in is odd, then the square root of the random number is stored in the Value union and Odd in the Type. The output from the print function should look like the following. Make use of the TypeString array in your print() function. Number is even 42 Number is even 68 Number is odd 5.91608 Number is odd 1 Number is even 70 Number is odd 5 Number is odd 8.88819 Number is odd 7.68115 Number is odd 7.93725 Number is odd 8.06226
Project ID: 5068689

About the project

3 proposals
Remote project
Active 11 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hi, client. I am interested in this job. Please give me this job. I think this is very easy for me. Regards.
$14 USD in 0 day
2.9 (11 reviews)
4.7
4.7
3 freelancers are bidding on average $18 USD for this job
User Avatar
Hi We are experts in c++ ,we can do the programming for you .You can palce order with us .... Thanks
$30 USD in 2 days
0.0 (0 reviews)
0.0
0.0
User Avatar
Brother! I want to do this. i will provide you best. Just gave a chance to your brother. I want to start it now. Regards
$10 USD in 0 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of UNITED STATES
Sunnyvale, United States
5.0
22
Member since Oct 16, 2013

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.