Find Us On: Facebook Twitter Rss Feed Blog
Need To Register? Sign Up Login

c program

fotrangod
fotrangod 


to generate random numbers and print int with three spaces between them and real a float number from output file. Can you please do all work in gedit on linux or visual studio thanks. extension must be .c Attachments Tags Clarifications

Answers

Lab #3

felo
felo 



find attached solution Attachments
lab3.zip (2 K) Download
Preview
3 4 3 4 4 Problem 3 Read a float number from a file and output it with 2 digits after the decimal point. The number should have at least 6 digits BEFORE the decimal point. Extract all digits until a decimal point is found then store the position. Then,

Preview
// Seed the RNG once, at the start of the program srand( time( NULL ) ); // Roll our die cast();

Preview
// Print a prompt printf("Please enter a number between or equal to 0 and 32767: "); // Get user input scanf("%d",&num); // Check if value outside of range if ((num < 0) || (num > 32767)) { printf("Outside of

Preview
txtFloat /= 10; //Extract last 2 digits (before decimal) ldig2 = (int)txtFloat % 10; txtFloat /= 10; //Extract last digits (before decimal) ldig1 = (int)txtFloat % 10; txtFloat /= 10; //Print the digits in even positions in REVERSE order

random.png (32 K) Download Preview

Screenshots
Screenshot
Purchase Answer