cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
if ( float X is incrementing){...run thi
if ( float X is incrementing){...run this code...}
Jan 9, 2013 at 12:32am UTC
noob2pro
(5)
Hi this is my first post and I'm a bit of a noob but it would be great if you could help me with this.
as you can see I want to make an 'if' statement that runs the code if the variable I have chosen is counting up.
Jan 9, 2013 at 1:05am UTC
vlad from moscow
(6539)
You should compare the current value of the variable with its previous value.
Jan 9, 2013 at 3:28pm UTC
noob2pro
(5)
So maybe something like..
float A;
float preA;
do {
// make 'preA' equal to 'A' at the start of the loop
preA = A;
// an option that will increment 'A'
if(... ) { ++A }
// then to check if 'A' is incrementing
// 'A' holds the new value and 'preA' holds the original value
if( A>preA){ cout<<"A is incrementing" }
Last edited on
Jan 9, 2013 at 3:30pm UTC
Topic archived. No new replies allowed.