One solution involves "typecasting," or changing floats to integers. While there are probably better ways of accomplishing this, here is one that juggles the floating point result and typecasts it into integers to get the desired values:
Code:
#include <stdio.h>
#define TAXRATE .056
int main(void)
{
float item, tax, total_cost;
int dollars,cents;
printf("Enter the value of your item\n");
scanf(" %f", &item);
tax = item * TAXRATE;
total_cost = item + tax;
// truncate value to whole number (remove "cents") by typecasting to an integer
dollars = (int)total_cost;
// subtract "dollars" from total cost, multiply "cents" by 100 to get this value
// as an integer, and typecast it to an integer
cents = (int)((total_cost - dollars)*100);
printf("Your item of $%.2f with sales tax is %.2f", item, total_cost);
// desired output
printf("\nItem is %d dollars and %d cents\n",dollars,cents);
getchar();
return 0;