How do I make My program display a remainder

Posted By: Cactus

How do I make My program display a remainder - 10/28/08 05:08

My program wont display a remainder on the screen only a whole number. I have read through the lite c workshop and I hav'nt seen anything about it(possibly missed it).
Any help would be great thnx.
Posted By: Neurosys

Re: How do I make My program display a remainder - 10/28/08 06:14

use format string parameters like "%0.0f" to represent your #... if that doesnt help paste the code and i'll have a looksee
Posted By: lostclimate

Re: How do I make My program display a remainder - 10/28/08 06:17

I think that is what the modulus operator is for, but im not sure.
Posted By: Cactus

Re: How do I make My program display a remainder - 10/28/08 07:21

k now I don'nt know where to put the modulus opperator. here my code

#include <acknex.h>
#include <default.c>

STRING* time_hour_str = "time_hour";
STRING* time_used_hour_str = "time_used_hour";
STRING* time_left_hour_str = "time_left_hour";

var time_hour = 5;
var time_used_hour = 3;
var time_left_hour = 0;
var time_hour2 = 0;
var time_used_hour2 =0;



var time_min = 50;
var time_used_min = 21;
var time_left_min = 0;


PANEL* pDisplay_time_hour =
{
digits (10, 10, 5, *, 1, time_hour);
flags = VISIBLE;
}

PANEL* pDisplay_time_used_hour =
{
digits (10, 20, 5, *, 1, time_used_hour;
flags = VISIBLE;
}

PANEL* pDisplay_time_left_hour =
{
digits (10, 30, 5, *, 1, time_left_hour;
flags = VISIBLE;
}






TEXT* time_txt =
{
pos_x = 300;
pos_y = 250;
string (time_hour_str);
flags = VISIBLE;
}

TEXT* time_used_txt =
{
pos_x = 300;
pos_y = 275;
string (time_used_hour_str);
flags = VISIBLE;
}


TEXT* time_left_txt =
{
pos_x = 300;
pos_y = 300;
string (time_left_hour_str);
flags = VISIBLE;
}


function calc_time()

{



time_hour = time_hour * 60 + time_min ;
time_used_hour = time_used_hour * 60 + time_used_min;


time_left_hour = time_hour - time_used_hour;


time_left_hour = time_left_hour / 60;


}

/////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////

function main()
{
video_mode = 7; // create a program window of 800x600 pixels
screen_color.blue = 150; // and make its background dark blue
calc_time();

}
© 2024 lite-C Forums