Solved

simple question

Posted on 1998-12-15
2
160 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

679 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