Solved

simple question

Posted on 1998-12-15
2
155 Views
Last Modified: 2010-04-02
I have a for loop that counts to a given number.
I have to stop at every time the count reaches 12.
12,24 ,36 etc.
for(int i=0;i<count;i++)
{
 if(i==12)
  {
  cout<<"test"; //this is what started out with.
  }
}
Please help.
Thank you
0
Comment
Question by:strmtrpr
2 Comments
 

Accepted Solution

by:
vmehro earned 20 total points
ID: 1180259
if (i%12 == 0) will take care of 12 and multiples of 12.


0
 

Author Comment

by:strmtrpr
ID: 1180260
Thank you very much.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
why "." vs "->" 23 119
How do I open an Access Data base with a password set using C++ 2 110
Least Squares Curve Fitting 4 61
max float value 3 26
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now