473,394 Members | 1,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

i need to increment my variable in fastly.

i need help for fast increment.

i assigned int i=0; when my condition get true (1), i want to get fast increment(example...i= 1, 53 , 63 ,100 this type of increment)in i value .so how i ll write a code in c.

sorry for my English .
thanks for advance help
Aug 27 '15 #1
5 1313
weaknessforcats
9,208 Expert Mod 8TB
I need more information. What do you mean by "fast" increment?
Can you give me a better example?
Aug 27 '15 #2
thank u sir,

now i am working as a embedded developer ..in my project contain 3 buttons(up & down & menu) .int i=0 , when press up button once int i should increment to 1...after release then same button pressed i=2 this is common code..

int a,i=0;
if(input(up)==0)
{
a=++i;
printf("%d",a);
}

so now pressed up button continuously then my i value get multiple increment....example, 1,3,4,6,64,87,93,356,467..this is not needed but this type of increment needed.
with regards,
karthik
thank you for advance help
Aug 28 '15 #3
weaknessforcats
9,208 Expert Mod 8TB
What is the algorithm for this sequence: 1,3,4,6,64,87,93,356,467 ?

There are two parts involved in the "up" button being pressed: key-up and key-down. Are you able to sense these two states?

If so, repeated key-down events would cause your sequence to be calculated.

The key-up would reset the sequence.

Tell me more.
Aug 28 '15 #4
maximum value = 1000.
int i;

if(condition_1==true)
{
//variable i should get increment by 1.
}

else if(condition_2==true)
{
//variable i should reach the maximum value 1000 faster . How to write logic for this???
}

thanks
Aug 29 '15 #5
weaknessforcats
9,208 Expert Mod 8TB
//variable i should reach the maximum value 1000 faster . How to write logic for this???

Yes, I understand that. But what I want to know is how you calculated these numbers: 1,3,4,6,64,87,93,356,467 ?
Aug 29 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Hans | last post by:
Hi There, I have a page that has links with some variables and I need to open the results set in a frameset. I have tried doing this in various different ways, but still cannot get the variable...
2
by: Hans-Michael Rupp | last post by:
Hello! I need to a assign a node(-set) conditionally to a varialbe like: <xsl:variable name="foo"> <xsl:if test="$bar=''"> <!-- how can I access a node here ?--> </xsl:if> <xsl:if...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
1
by: Brett Hofer | last post by:
Does anyone know of a good component for audio(.WAV) playback that supports double-speed/normal/half-speed? I need to provide this control in an .aspx page and control it using C#. I have tried...
2
by: Ramez T. Mina | last post by:
I tried to increment variable when I click on a button, but it didn't work. I use the VB.NET editor and not the HTML editor. any one can help??
41
by: Miguel Dias Moura | last post by:
Hello, I am working on an ASP.NET / VB page and I created a variable "query": Sub Page_Load(sender As Object, e As System.EventArgs) Dim query as String = String.Empty ... query =...
5
by: Jim via DotNetMonster.com | last post by:
Hi, I need to pass the value of a variable from one function to another but I don't seem to get the value. I declare the variable outside all functions. What I'm trying to do is that when the...
3
by: ali | last post by:
Hi, When I pass a pointer as an argument of a method, is it safe if I change the data pointed by the argument and return it upon completion ? For example: Object* someFunction(Object* ob)...
1
by: mrityunjay11 | last post by:
the code is as #!/bin/sh i=1; while do echo "welcome $i times"; i= 'expr $i + 1 '; done
35
by: erik gartz | last post by:
Hi. I'd like to be able to write a loop such as: for i in range(10): pass but without the i variable. The reason for this is I'm using pylint and it complains about the unused variable i. I can...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.