Solved

simple question

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exception thrown at 0x00007FFD5BC81F28 7 44
Arduino EDI - Programming language 3 95
Header of docx file 17 103
Problem with SqlConnection 4 170
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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.

803 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