473,395 Members | 1,790 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,395 software developers and data experts.

need a cooment for looping

i have a problem in displaying the even value. i try to do the exercise
in asking the user of the value of x and the value of y. then, showing
the value bettween x and y. in between the value x and y there suppose
to be an even and odd number.
for exampe if the value x = 1 and the value of y = 5. then it will
write 12345. (i done this). but, i have the problem in showing the even
value between x and y . i use for loops for showing the 12345 and then
i confused for showing the even value. i know the formula would be
value*2..

Sep 30 '06 #1
4 1363
#include <iostream>
using namespace std;

void foo(int low, int high)
{
for (int i=low; i<=high; ++i)
if ((i%2)==0) cout<<i;
cout<<endl;
}

int main()
{
foo(1, 5);
system("pause");
return 0;
}

Sep 30 '06 #2
thank you
lw1a2 wrote:
#include <iostream>
using namespace std;

void foo(int low, int high)
{
for (int i=low; i<=high; ++i)
if ((i%2)==0) cout<<i;
cout<<endl;
}

int main()
{
foo(1, 5);
system("pause");
return 0;
}
Sep 30 '06 #3
thank's
lw1a2 wrote:
#include <iostream>
using namespace std;

void foo(int low, int high)
{
for (int i=low; i<=high; ++i)
if ((i%2)==0) cout<<i;
cout<<endl;
}

int main()
{
foo(1, 5);
system("pause");
return 0;
}
Sep 30 '06 #4

"lw1a2" <lw********@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
#include <iostream>
using namespace std;

void foo(int low, int high)
{
for (int i=low; i<=high; ++i)
if ((i%2)==0) cout<<i;
cout<<endl;
}

int main()
{
foo(1, 5);
system("pause");
return 0;
}
How about not just doing others' homework for them, eh? How's he supposed
to learn anything if all his answers are simply handed to him? Do you want
to work with some idiot who passed his courses simply by asking others to do
their work?

-Howard

Oct 2 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: masood.iqbal | last post by:
My simplistic mind tells me that having local variables within looping constructs is a bad idea. The reason is that these variables are created during the beginning of an iteration and deleted at...
2
by: RCB | last post by:
I created a new Vb.NET project and used the Data Form Wizard to create a dataset and grid to view a single table from my database. Later I read an article about creating a Typed Dataset. I was...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
43
by: SLH | last post by:
hi people. im trying to validate input received via a text area on an ASP page before writing it to a database. i cant use client side javascript due to policy, so it all has to happen on the...
21
by: asif929 | last post by:
I need immediate help in writing a function program. I have to write a program in functions and use array to store them. I am not familiar with functions and i tried to create it but i fails to...
1
by: darrel | last post by:
Hi vb master i need help on this here my code: If Combo1(0) = rs.Fields("TimeStart") And Combo4(0) = rs.Fields("TimeEnd") And Combo2(0) = rs.Fields("ROOM") And Combo3(0) = rs.Fields("DAYS")...
20
by: Ifoel | last post by:
Hi all, Sorry im beginer in vb. I want making programm looping character or number. Just say i have numbers from 100 to 10000. just sample: Private Sub Timer1_Timer() if check1.value= 1...
2
by: Davaa | last post by:
Dear all, I am a student making a MS Form application in C++. I would ask a question about "Timer". Sample code which I am developing is below. private: System::Void...
1
by: vijayarl | last post by:
Hi Everyone, i have the written this logic : basically a file operation open (CONFIGFILE, "$config_file") or die; while (<CONFIGFILE>) { chomp;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.