<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>VBForums - C and C++</title>
		<link>http://www.vbforums.com/</link>
		<description>Discuss anything that you want about C and C++ here!</description>
		<language>en</language>
		<lastBuildDate>Sat, 18 May 2013 05:05:56 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.vbforums.com/images/misc/rss.png</url>
			<title>VBForums - C and C++</title>
			<link>http://www.vbforums.com/</link>
		</image>
		<item>
			<title>Getting the elapsed number of days</title>
			<link>http://www.vbforums.com/showthread.php?721699-Getting-the-elapsed-number-of-days&amp;goto=newpost</link>
			<pubDate>Wed, 15 May 2013 06:42:45 GMT</pubDate>
			<description><![CDATA[Hello,


Code:
---------
gcc 4.7.2
c89
---------
I have developed a sample program that should get the difference between a start time and an end time. I then use the seconds to calculate how many days has elapsed between those 2 times.

This is for a logging application that after a user specified number of days. The logs will be rolled over and a new start time will be set. The user can decide how many days the log will be replaced.

I added a small sleep to get the general idea, but normally this will be logging for days.

Is this the best and most portable (linux/windows) way to do this? Any potential pitfalls in this design?

Many thanks for any suggestions,


Code:
---------
#include <time.h>
#include <stdio.h>
#include <string.h>

int main(void)
{
    time_t start_timestamp;
    time_t end_timestamp;
    struct tm time_days;
    double seconds = 0;
    size_t cumulative_days = 0;
#define FORMAT_TIME_SIZE 64
    char format_time[FORMAT_TIME_SIZE];

#define DAY 3600     /* Seconds in one day */
#define MAX_DAYS 10  /* Roll over log after 10 days */

    /* Current time of starting application */
    time(&start_timestamp);
    time_days = *localtime(&start_timestamp);

    /* Print the current time at the start */
    memset(format_time, 0, sizeof format_time);
    strftime(format_time, sizeof format_time, "%c", &time_days);
    printf("timestamp start [ %s ]\n", format_time);

    /* Simulate a simple sleep. This could be logging for many days */
    sleep(10);

    /* Current time after delay print the results */
    time(&end_timestamp);
    time_days = *localtime(&end_timestamp);
    memset(format_time, 0, sizeof format_time);
    strftime(format_time, sizeof format_time, "%c", &time_days);
    printf("timestamp end [ %s ]\n", format_time);

    /* Get the current difference in seconds */
    seconds = difftime(end_timestamp, start_timestamp);
    printf("Seconds elapsed [ %f ]\n", seconds);

    /* Calculate how many days have elapsed */
    cumulative_days = DAY * seconds;

    /* What are we going to do */
    if(cumulative_days <= MAX_DAYS) {
        printf("Delete log and start over\n");
    }
    else {
        printf("Not there yet, keep appending the current log\n");
    }

    return 0;
}
---------
]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">gcc 4.7.2<br />
c89</code><hr />
</div>I have developed a sample program that should get the difference between a start time and an end time. I then use the seconds to calculate how many days has elapsed between those 2 times.<br />
<br />
This is for a logging application that after a user specified number of days. The logs will be rolled over and a new start time will be set. The user can decide how many days the log will be replaced.<br />
<br />
I added a small sleep to get the general idea, but normally this will be logging for days.<br />
<br />
Is this the best and most portable (linux/windows) way to do this? Any potential pitfalls in this design?<br />
<br />
Many thanks for any suggestions,<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#include &lt;time.h&gt;<br />
#include &lt;stdio.h&gt;<br />
#include &lt;string.h&gt;<br />
<br />
int main(void)<br />
{<br />
&nbsp; &nbsp; time_t start_timestamp;<br />
&nbsp; &nbsp; time_t end_timestamp;<br />
&nbsp; &nbsp; struct tm time_days;<br />
&nbsp; &nbsp; double seconds = 0;<br />
&nbsp; &nbsp; size_t cumulative_days = 0;<br />
#define FORMAT_TIME_SIZE 64<br />
&nbsp; &nbsp; char format_time[FORMAT_TIME_SIZE];<br />
<br />
#define DAY 3600&nbsp; &nbsp;  /* Seconds in one day */<br />
#define MAX_DAYS 10&nbsp; /* Roll over log after 10 days */<br />
<br />
&nbsp; &nbsp; /* Current time of starting application */<br />
&nbsp; &nbsp; time(&amp;start_timestamp);<br />
&nbsp; &nbsp; time_days = *localtime(&amp;start_timestamp);<br />
<br />
&nbsp; &nbsp; /* Print the current time at the start */<br />
&nbsp; &nbsp; memset(format_time, 0, sizeof format_time);<br />
&nbsp; &nbsp; strftime(format_time, sizeof format_time, &quot;%c&quot;, &amp;time_days);<br />
&nbsp; &nbsp; printf(&quot;timestamp start [ %s ]\n&quot;, format_time);<br />
<br />
&nbsp; &nbsp; /* Simulate a simple sleep. This could be logging for many days */<br />
&nbsp; &nbsp; sleep(10);<br />
<br />
&nbsp; &nbsp; /* Current time after delay print the results */<br />
&nbsp; &nbsp; time(&amp;end_timestamp);<br />
&nbsp; &nbsp; time_days = *localtime(&amp;end_timestamp);<br />
&nbsp; &nbsp; memset(format_time, 0, sizeof format_time);<br />
&nbsp; &nbsp; strftime(format_time, sizeof format_time, &quot;%c&quot;, &amp;time_days);<br />
&nbsp; &nbsp; printf(&quot;timestamp end [ %s ]\n&quot;, format_time);<br />
<br />
&nbsp; &nbsp; /* Get the current difference in seconds */<br />
&nbsp; &nbsp; seconds = difftime(end_timestamp, start_timestamp);<br />
&nbsp; &nbsp; printf(&quot;Seconds elapsed [ %f ]\n&quot;, seconds);<br />
<br />
&nbsp; &nbsp; /* Calculate how many days have elapsed */<br />
&nbsp; &nbsp; cumulative_days = DAY * seconds;<br />
<br />
&nbsp; &nbsp; /* What are we going to do */<br />
&nbsp; &nbsp; if(cumulative_days &lt;= MAX_DAYS) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Delete log and start over\n&quot;);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Not there yet, keep appending the current log\n&quot;);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; return 0;<br />
}</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>steve_rm</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?721699-Getting-the-elapsed-number-of-days</guid>
		</item>
		<item>
			<title>vc++  to vb</title>
			<link>http://www.vbforums.com/showthread.php?720569-vc-to-vb&amp;goto=newpost</link>
			<pubDate>Sun, 05 May 2013 13:16:27 GMT</pubDate>
			<description>I need runtime crystal report layout designer...

I got this link but its in vc++ and i need it in vb.net 2008 windows app project
http://www.codeproject.com/Articles/...esigner-Viewer

Can i convert vc++ to dll so i can use it...

I dont have any idea of vc++ plz help ...its too urgent

Thanks in advance!!</description>
			<content:encoded><![CDATA[<div>I need runtime crystal report layout designer...<br />
<br />
I got this link but its in vc++ and i need it in vb.net 2008 windows app project<br />
<a rel="nofollow" href="http://www.codeproject.com/Articles/...esigner-Viewer" target="_blank">http://www.codeproject.com/Articles/...esigner-Viewer</a><br />
<br />
Can i convert vc++ to dll so i can use it...<br />
<br />
I dont have any idea of vc++ plz help ...its too urgent<br />
<br />
Thanks in advance!!</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>afreen</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?720569-vc-to-vb</guid>
		</item>
		<item>
			<title>Structure Conversion between VB6 and C</title>
			<link>http://www.vbforums.com/showthread.php?720301-Structure-Conversion-between-VB6-and-C&amp;goto=newpost</link>
			<pubDate>Thu, 02 May 2013 22:01:58 GMT</pubDate>
			<description><![CDATA[My VB6 program should call C DLL.
I should pass structure type as a parameter.
Original C structure is like following.

typedef struct strIniSensor
{
const char* theInitFile;
CallBackFunc IniSensorCallBack;
void * CallBackParameters;
}strIniSensor;

I made VB6 side Type Definition like following.
Type strIniSensor '
theInitFile As String
IniSensorCallBack As Long 
CallBackParameters As Long
End Type

Is this correct? vensor who provide dll says I can assign NULL to all items(theInitFile,IniSensorCallBack,CallBackParameters) in the structure.]]></description>
			<content:encoded><![CDATA[<div>My VB6 program should call C DLL.<br />
I should pass structure type as a parameter.<br />
Original C structure is like following.<br />
<br />
typedef struct strIniSensor<br />
{<br />
const char* theInitFile;<br />
CallBackFunc IniSensorCallBack;<br />
void * CallBackParameters;<br />
}strIniSensor;<br />
<br />
I made VB6 side Type Definition like following.<br />
Type strIniSensor '<br />
theInitFile As String<br />
IniSensorCallBack As Long <br />
CallBackParameters As Long<br />
End Type<br />
<br />
Is this correct? vensor who provide dll says I can assign NULL to all items(theInitFile,IniSensorCallBack,CallBackParameters) in the structure.</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>jdy0803</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?720301-Structure-Conversion-between-VB6-and-C</guid>
		</item>
		<item>
			<title>how build a dynamic array from a struture?</title>
			<link>http://www.vbforums.com/showthread.php?719347-how-build-a-dynamic-array-from-a-struture&amp;goto=newpost</link>
			<pubDate>Thu, 25 Apr 2013 15:51:01 GMT</pubDate>
			<description><![CDATA[imagine that you have these struct:

Code:
---------
struct Person
{
    char Name[255];
    int age;
};
---------
and you create a variable array:
Person a[20];
but then you only need 3. how can i change it?
i try several things and read some info, but i only get errors:(
i understand that i'm using C code with some C++, but i don't know C++(for now).. after i finish C i will;)
these sample is for see if i can do something... i'm tired loking for something and nothing works:(]]></description>
			<content:encoded><![CDATA[<div>imagine that you have these struct:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">struct Person<br />
{<br />
&nbsp; &nbsp; char Name[255];<br />
&nbsp; &nbsp; int age;<br />
};</code><hr />
</div>and you create a variable array:<br />
Person a[20];<br />
but then you only need 3. how can i change it?<br />
i try several things and read some info, but i only get errors:(<br />
i understand that i'm using C code with some C++, but i don't know C++(for now).. after i finish C i will;)<br />
these sample is for see if i can do something... i'm tired loking for something and nothing works:(</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>joaquim</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?719347-how-build-a-dynamic-array-from-a-struture</guid>
		</item>
		<item>
			<title>Calling convention in making DLL</title>
			<link>http://www.vbforums.com/showthread.php?719099-Calling-convention-in-making-DLL&amp;goto=newpost</link>
			<pubDate>Tue, 23 Apr 2013 17:49:41 GMT</pubDate>
			<description><![CDATA[I'm trying making DLL which is compatible with Visual Studio 6.0 from Visual Studio 2010.
In case of Visual Studio 6.0, there was no calling convention in the properties but I was able to set calling convention to each functions respectively like following.

extern "C" __declspec (dllexport) int __stdcall MyFunc( int num );

So I could use __stdcall for the functions to be called from VB6 and __cdecl for internal used function.

However, there's calling convention option in the Project Properties > Configuration Properties > C/C++ > Advanced > Calling Convention.
If I choose one,for example,  __stdcall, "unresolved exter variables"error occurs at internal function(__cdecl).

How to use Calling Convention in Visual Studio 2010?]]></description>
			<content:encoded><![CDATA[<div>I'm trying making DLL which is compatible with Visual Studio 6.0 from Visual Studio 2010.<br />
In case of Visual Studio 6.0, there was no calling convention in the properties but I was able to set calling convention to each functions respectively like following.<br />
<br />
extern &quot;C&quot; __declspec (dllexport) int __stdcall MyFunc( int num );<br />
<br />
So I could use __stdcall for the functions to be called from VB6 and __cdecl for internal used function.<br />
<br />
However, there's calling convention option in the Project Properties &gt; Configuration Properties &gt; C/C++ &gt; Advanced &gt; Calling Convention.<br />
If I choose one,for example,  __stdcall, &quot;unresolved exter variables&quot;error occurs at internal function(__cdecl).<br />
<br />
How to use Calling Convention in Visual Studio 2010?</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>jdy0803</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?719099-Calling-convention-in-making-DLL</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] Void Pointer Function type]]></title>
			<link>http://www.vbforums.com/showthread.php?719039-RESOLVED-Void-Pointer-Function-type&amp;goto=newpost</link>
			<pubDate>Tue, 23 Apr 2013 08:46:56 GMT</pubDate>
			<description><![CDATA[Hello,

For a University assignment, I've been tasked to create a memory management Class for a program. We've been given a Class we are to design it from.

I've basically got this all done, but we've been given a virtual function like this in a Class we must inherit:

Code:
---------
virtual void* vcalloc(size_t size) {}
---------
This function should be able to be used as such:

Code:
---------
int *someNewInt = (int*)memObj.vcalloc(sizeof(int));
---------
I don't understand how to do this? Can't use return, and no pointers are passed as a parameter to change. If someone can give me an example of this I would be extremely appreciative! I've Google'd around a bit, but can't find anything that has an example such as this.]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
For a University assignment, I've been tasked to create a memory management Class for a program. We've been given a Class we are to design it from.<br />
<br />
I've basically got this all done, but we've been given a virtual function like this in a Class we must inherit:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">virtual void* vcalloc(size_t size) {}</code><hr />
</div>This function should be able to be used as such:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">int *someNewInt = (int*)memObj.vcalloc(sizeof(int));</code><hr />
</div>I don't understand how to do this? Can't use return, and no pointers are passed as a parameter to change. If someone can give me an example of this I would be extremely appreciative! I've Google'd around a bit, but can't find anything that has an example such as this.</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>Slyke</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?719039-RESOLVED-Void-Pointer-Function-type</guid>
		</item>
		<item>
			<title>importing a function from a dll  in vc.net</title>
			<link>http://www.vbforums.com/showthread.php?718927-importing-a-function-from-a-dll-in-vc-net&amp;goto=newpost</link>
			<pubDate>Mon, 22 Apr 2013 14:24:56 GMT</pubDate>
			<description><![CDATA[although this is a vc.net  question,  someone here might know the answer.

I have a function in a dll called import10.

it is:
void FAR PASCAL  junk(long&jj)
{
	long j;
	j=999;
	jj=j;


  //end of junk
}
and I include junk in the def file


I am trying to call junk from another dll --called mfdm

I write:
__declspec(dllimport) void _stdcall junk(long&x);
above the function that includes a call to junk

and I have gone into the properties of mfdm and set the c/c++ general\additional library directories to
c:\davids\vcnet\import10\debug\
which is where the import10.lib exist

upon compiling it doesn't find junk

if you can help thanks!!

follys]]></description>
			<content:encoded><![CDATA[<div>although this is a vc.net  question,  someone here might know the answer.<br />
<br />
I have a function in a dll called import10.<br />
<br />
it is:<br />
void FAR PASCAL  junk(long&amp;jj)<br />
{<br />
	long j;<br />
	j=999;<br />
	jj=j;<br />
<br />
<br />
  //end of junk<br />
}<br />
and I include junk in the def file<br />
<br />
<br />
I am trying to call junk from another dll --called mfdm<br />
<br />
I write:<br />
__declspec(dllimport) void _stdcall junk(long&amp;x);<br />
above the function that includes a call to junk<br />
<br />
and I have gone into the properties of mfdm and set the c/c++ general\additional library directories to<br />
c:\davids\vcnet\import10\debug\<br />
which is where the import10.lib exist<br />
<br />
upon compiling it doesn't find junk<br />
<br />
if you can help thanks!!<br />
<br />
follys</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>follys</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?718927-importing-a-function-from-a-dll-in-vc-net</guid>
		</item>
		<item>
			<title>Losing data by converting int to float</title>
			<link>http://www.vbforums.com/showthread.php?718877-Losing-data-by-converting-int-to-float&amp;goto=newpost</link>
			<pubDate>Mon, 22 Apr 2013 08:57:07 GMT</pubDate>
			<description><![CDATA[Hi everyone who reads this,

I'm writing a easy code that handles change(as in money) so that it tells how much your change is and in how many of each bills to give back (like 20's 10's 5's etc...) 

When I compile the code it gets that warning that "convertion from into to float may cause data loss" and I do.
Sometimes the output will be correct and give me the right amount, but sometimes I lose a penny in the process and end up being short one penny. 

EX: Price = 12.34
      Tendered = 20.00

Change: 7.66

Five: 1
Dollars: 2
Quarters:2
Dimes:1
Nickles:1
Penny: 0

The actual output is bit longer than that but you get my point. I's missing that 1 penny and I can't figure out what my problem is x.x I think it might how I set up the 
calculating process. 
If someone can look at my code and maybe point out where my problem is and what I should do to fix it that would be greatly appreciated. 


Code:
---------
//
//  ChangeCounter.c
//  
//
//  Created by Batnyagt Batsuren on April 20,2013
//  Copyright (c) 2013 Batnyagt Batsuren
//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


#define EXIT_SUCCESS 0
#define EXIT_FAIL -1

int main(void)

{
    //variables
    int change_Twenties = 0;
    int change_Tens = 0;
	int change_Fives = 0;
    int change_Dollars = 0;
    int change_Quarters = 0;
    int change_Dimes = 0;
    int change_Nickels = 0;
    int change_Cents = 0;

    float input_Price = 0.0;
    float tender_Amount = 0.0;
    float change_Amount = 0.0;

    //prompts for item price
	printf("Thank You for using my Change Counter \n");
    printf("Please enter price in dollars and cents:  \n $ ");
    scanf("%f", &input_Price);

    //prompts for amount tendered
    printf("Please enter tendered amount:  \n $ ");
    scanf("%f", &tender_Amount);
    
	
	//calculating change amount
	change_Amount = tender_Amount - input_Price;
    //If inputed tender amount is smaller than price,
	if (change_Amount < 0)
    {
        printf("Please enter a value that's greater or equals to price of item.\n");
		getchar();
		getchar();
        return EXIT_FAIL;
    }
    // sets each variable to the correct amount of each and takes away the amount from change cents
    

	change_Cents = (change_Amount * 100.0);
    printf("%d cents \n", change_Cents);

    //change 20's
    change_Twenties = (change_Cents / 2000);
    change_Cents %= 2000;

    //change Tens
    change_Tens = (change_Cents / 1000);
    change_Cents %= 1000;

    //change dollars
    change_Dollars = (change_Cents / 100);
    change_Cents %= 100;

    //change quarter
    change_Quarters = (change_Cents / 25);
    change_Cents %=  25;

    //change dimes
    change_Dimes = (change_Cents / 10);
    change_Cents %=  10;

    //change nickels
    change_Nickels = (change_Cents / 5);
    change_Cents %=  5;

    //debug
    printf("$%5.2f \n", input_Price);
    printf("$%5.2f \n", tender_Amount);
    printf("$%5.2f \n", change_Amount);
    printf("%d Twenties \n", change_Twenties);
    printf("%d Tens \n", change_Tens);
    printf("%d Fives \n", change_Fives);
    printf("%d Dollars \n", change_Dollars);
    printf("%d Quarters \n", change_Quarters);
    printf("%d Dimes \n", change_Dimes);
    printf("%d Nickels \n", change_Nickels);
    printf("%d Cents \n", change_Cents);
    getchar();
	getchar();

    return EXIT_SUCCESS;
}
---------
]]></description>
			<content:encoded><![CDATA[<div>Hi everyone who reads this,<br />
<br />
I'm writing a easy code that handles change(as in money) so that it tells how much your change is and in how many of each bills to give back (like 20's 10's 5's etc...) <br />
<br />
When I compile the code it gets that warning that &quot;convertion from into to float may cause data loss&quot; and I do.<br />
Sometimes the output will be correct and give me the right amount, but sometimes I lose a penny in the process and end up being short one penny. <br />
<br />
EX: Price = 12.34<br />
      Tendered = 20.00<br />
<br />
Change: 7.66<br />
<br />
Five: 1<br />
Dollars: 2<br />
Quarters:2<br />
Dimes:1<br />
Nickles:1<br />
Penny: 0<br />
<br />
The actual output is bit longer than that but you get my point. I's missing that 1 penny and I can't figure out what my problem is x.x I think it might how I set up the <br />
calculating process. <br />
If someone can look at my code and maybe point out where my problem is and what I should do to fix it that would be greatly appreciated. <br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">//<br />
//&nbsp; ChangeCounter.c<br />
//&nbsp; <br />
//<br />
//&nbsp; Created by Batnyagt Batsuren on April 20,2013<br />
//&nbsp; Copyright (c) 2013 Batnyagt Batsuren<br />
//<br />
#include &lt;stdio.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
#include &lt;math.h&gt;<br />
<br />
<br />
#define EXIT_SUCCESS 0<br />
#define EXIT_FAIL -1<br />
<br />
int main(void)<br />
<br />
{<br />
&nbsp; &nbsp; //variables<br />
&nbsp; &nbsp; int change_Twenties = 0;<br />
&nbsp; &nbsp; int change_Tens = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int change_Fives = 0;<br />
&nbsp; &nbsp; int change_Dollars = 0;<br />
&nbsp; &nbsp; int change_Quarters = 0;<br />
&nbsp; &nbsp; int change_Dimes = 0;<br />
&nbsp; &nbsp; int change_Nickels = 0;<br />
&nbsp; &nbsp; int change_Cents = 0;<br />
<br />
&nbsp; &nbsp; float input_Price = 0.0;<br />
&nbsp; &nbsp; float tender_Amount = 0.0;<br />
&nbsp; &nbsp; float change_Amount = 0.0;<br />
<br />
&nbsp; &nbsp; //prompts for item price<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Thank You for using my Change Counter \n&quot;);<br />
&nbsp; &nbsp; printf(&quot;Please enter price in dollars and cents:&nbsp; \n $ &quot;);<br />
&nbsp; &nbsp; scanf(&quot;%f&quot;, &amp;input_Price);<br />
<br />
&nbsp; &nbsp; //prompts for amount tendered<br />
&nbsp; &nbsp; printf(&quot;Please enter tendered amount:&nbsp; \n $ &quot;);<br />
&nbsp; &nbsp; scanf(&quot;%f&quot;, &amp;tender_Amount);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //calculating change amount<br />
&nbsp; &nbsp; &nbsp; &nbsp; change_Amount = tender_Amount - input_Price;<br />
&nbsp; &nbsp; //If inputed tender amount is smaller than price,<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (change_Amount &lt; 0)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Please enter a value that's greater or equals to price of item.\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getchar();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getchar();<br />
&nbsp; &nbsp; &nbsp; &nbsp; return EXIT_FAIL;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; // sets each variable to the correct amount of each and takes away the amount from change cents<br />
&nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; change_Cents = (change_Amount * 100.0);<br />
&nbsp; &nbsp; printf(&quot;%d cents \n&quot;, change_Cents);<br />
<br />
&nbsp; &nbsp; //change 20's<br />
&nbsp; &nbsp; change_Twenties = (change_Cents / 2000);<br />
&nbsp; &nbsp; change_Cents %= 2000;<br />
<br />
&nbsp; &nbsp; //change Tens<br />
&nbsp; &nbsp; change_Tens = (change_Cents / 1000);<br />
&nbsp; &nbsp; change_Cents %= 1000;<br />
<br />
&nbsp; &nbsp; //change dollars<br />
&nbsp; &nbsp; change_Dollars = (change_Cents / 100);<br />
&nbsp; &nbsp; change_Cents %= 100;<br />
<br />
&nbsp; &nbsp; //change quarter<br />
&nbsp; &nbsp; change_Quarters = (change_Cents / 25);<br />
&nbsp; &nbsp; change_Cents %=&nbsp; 25;<br />
<br />
&nbsp; &nbsp; //change dimes<br />
&nbsp; &nbsp; change_Dimes = (change_Cents / 10);<br />
&nbsp; &nbsp; change_Cents %=&nbsp; 10;<br />
<br />
&nbsp; &nbsp; //change nickels<br />
&nbsp; &nbsp; change_Nickels = (change_Cents / 5);<br />
&nbsp; &nbsp; change_Cents %=&nbsp; 5;<br />
<br />
&nbsp; &nbsp; //debug<br />
&nbsp; &nbsp; printf(&quot;$%5.2f \n&quot;, input_Price);<br />
&nbsp; &nbsp; printf(&quot;$%5.2f \n&quot;, tender_Amount);<br />
&nbsp; &nbsp; printf(&quot;$%5.2f \n&quot;, change_Amount);<br />
&nbsp; &nbsp; printf(&quot;%d Twenties \n&quot;, change_Twenties);<br />
&nbsp; &nbsp; printf(&quot;%d Tens \n&quot;, change_Tens);<br />
&nbsp; &nbsp; printf(&quot;%d Fives \n&quot;, change_Fives);<br />
&nbsp; &nbsp; printf(&quot;%d Dollars \n&quot;, change_Dollars);<br />
&nbsp; &nbsp; printf(&quot;%d Quarters \n&quot;, change_Quarters);<br />
&nbsp; &nbsp; printf(&quot;%d Dimes \n&quot;, change_Dimes);<br />
&nbsp; &nbsp; printf(&quot;%d Nickels \n&quot;, change_Nickels);<br />
&nbsp; &nbsp; printf(&quot;%d Cents \n&quot;, change_Cents);<br />
&nbsp; &nbsp; getchar();<br />
&nbsp; &nbsp; &nbsp; &nbsp; getchar();<br />
<br />
&nbsp; &nbsp; return EXIT_SUCCESS;<br />
}</code><hr />
</div></div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>oDust</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?718877-Losing-data-by-converting-int-to-float</guid>
		</item>
		<item>
			<title>Creating an .msi</title>
			<link>http://www.vbforums.com/showthread.php?718741-Creating-an-msi&amp;goto=newpost</link>
			<pubDate>Sat, 20 Apr 2013 19:37:18 GMT</pubDate>
			<description><![CDATA[I'm new to C++ and the program I'm trying to create is an installer (or msi). I'm having a very difficult time finding out how to make my program install the files onto a computer that chooses to run it. Can someone help me?]]></description>
			<content:encoded><![CDATA[<div>I'm new to C++ and the program I'm trying to create is an installer (or msi). I'm having a very difficult time finding out how to make my program install the files onto a computer that chooses to run it. Can someone help me?</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>Zevoxa</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?718741-Creating-an-msi</guid>
		</item>
		<item>
			<title><![CDATA[[RESOLVED] #define not working between includes]]></title>
			<link>http://www.vbforums.com/showthread.php?718693-RESOLVED-define-not-working-between-includes&amp;goto=newpost</link>
			<pubDate>Sat, 20 Apr 2013 10:10:48 GMT</pubDate>
			<description><![CDATA[I have the following code on my main.cpp:


Code:
---------
#ifdef _WIN64
#define hOS 1
#elif _WIN32
#define hOS 1
#elif __APPLE__
#define hOS 2
#elif __linux
#define hOS 3
#else
#define hOS 0
#endif

#include "functions.h"
---------
functions.h:

Code:
---------
#ifndef _FunctionsFile
#define _FunctionsFile

#include <string.h>
#include <iostream>

using namespace std;

void someFunction(bool someParameter);

#endif
---------
functions.cpp:

Code:
---------
#include "functions.h"
void someFunction(bool someParameter= false)
{
  if (hOS==1)
  {
    std::cout<<"Windows";
  }
}
---------
When trying to complile I get this error in functions.cpp:
C:\Dev\CPP\functions.cpp `hOS' undeclared (first use this function)]]></description>
			<content:encoded><![CDATA[<div>I have the following code on my main.cpp:<br />
<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#ifdef _WIN64<br />
#define hOS 1<br />
#elif _WIN32<br />
#define hOS 1<br />
#elif __APPLE__<br />
#define hOS 2<br />
#elif __linux<br />
#define hOS 3<br />
#else<br />
#define hOS 0<br />
#endif<br />
<br />
#include &quot;functions.h&quot;</code><hr />
</div>functions.h:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#ifndef _FunctionsFile<br />
#define _FunctionsFile<br />
<br />
#include &lt;string.h&gt;<br />
#include &lt;iostream&gt;<br />
<br />
using namespace std;<br />
<br />
void someFunction(bool someParameter);<br />
<br />
#endif</code><hr />
</div>functions.cpp:<br />
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	<hr /><code class="bbcode_code">#include &quot;functions.h&quot;<br />
void someFunction(bool someParameter= false)<br />
{<br />
&nbsp; if (hOS==1)<br />
&nbsp; {<br />
&nbsp; &nbsp; std::cout&lt;&lt;&quot;Windows&quot;;<br />
&nbsp; }<br />
}</code><hr />
</div>When trying to complile I get this error in functions.cpp:<br />
C:\Dev\CPP\functions.cpp `hOS' undeclared (first use this function)</div>

]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>Slyke</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?718693-RESOLVED-define-not-working-between-includes</guid>
		</item>
		<item>
			<title><![CDATA[Label, Back Color - Transparent isn't transparent?]]></title>
			<link>http://www.vbforums.com/showthread.php?718585-Label-Back-Color-Transparent-isn-t-transparent&amp;goto=newpost</link>
			<pubDate>Fri, 19 Apr 2013 13:01:38 GMT</pubDate>
			<description><![CDATA[I set the back color on a label to transparent and it's not transparent?

Attachment 99245 (http://www.vbforums.com/attachment.php?attachmentid=99245)]]></description>
			<content:encoded><![CDATA[<div>I set the back color on a label to transparent and it's not transparent?<br />
<br />
<img src="http://www.vbforums.com/attachment.php?attachmentid=99245&amp;d=1366376482" border="0" alt="Name:  4-19-2013 8-57-05 AM.png
Views: 58
Size:  3.2 KB"  /></div>


	<div style="padding:10px">

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
				<div style="padding:10px">
				<img class="attach" src="http://www.vbforums.com/attachment.php?attachmentid=99245&amp;stc=1&amp;d=1366376482" alt="" />&nbsp;
			</div>
		</fieldset>
	

	

	

	</div>
]]></content:encoded>
			<category domain="http://www.vbforums.com/forumdisplay.php?9-C-and-C">C and C++</category>
			<dc:creator>Zevoxa</dc:creator>
			<guid isPermaLink="true">http://www.vbforums.com/showthread.php?718585-Label-Back-Color-Transparent-isn-t-transparent</guid>
		</item>
	</channel>
</rss>
