Loading
Tweet
Videos
Blog
News
Forum
Games
Shop
Jobs
prev
A Simple Animation
Creating a Thread
AVL Trees, AVL Sort
Quantum Mechanics 2
The Code Snippets Panel in F...
Icy Fishes
Custom Classes for Object-Or...
The Village
Tangramz
Independence, Basis, and Dim...
next
May 22, 2013, 05:22:10 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: Welcome!
Forum Home
Help
Search Forum
Login
Register
XoaX.net Forum
>
Subjects
>
C++
>
Visual C++ IDE
(Moderator:
bluetoo
) >
While and Do While Loops
Pages: [
1
]
Go Down
« previous
next »
Send this topic
|
Print
Author
Topic: While and Do While Loops (Read 1215 times)
shadowblack
Newbie
Posts: 1
While and Do While Loops
«
on:
April 29, 2010, 01:14:19 PM »
Need help base in my program.I want a function that loop.For example 'press 1 to repeat the program from begining or press 0 to exit' at the end of my function.Can gimme an example?
Logged
fireocean
Newbie
Posts: 1
Re: While and Do While Loops
«
Reply #1 on:
June 05, 2011, 02:06:32 AM »
#include<iostream.h>
main()
{
int a=1,i,k,r,c;
int b=0;
while(c=a)
{
cout<<"enter the value of 1st no;"<<endl;
cin>>i;
cout<<"enter the value of 2nd no;"<<endl;
cin>>k;
cout<<" sum of the two number is "<<i+k<<endl;
cout<<"Do you want to continue press '0' "<<endl;
cin>>r;
c++;
}}
Logged
Haitam
Newbie
Posts: 16
Re: While and Do While Loops
«
Reply #2 on:
July 10, 2011, 04:26:28 AM »
while (1)
{
......
.......
..........
.
........
cout<<"to exit the program press 0"<<endl;
int state;
cin>>state;
if(state==0) exit(0);
}
Logged
Pages: [
1
]
Go Up
Send this topic
|
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Subjects
-----------------------------
=> C++
===> Console
===> OpenGL
===> MFC
===> Win32
===> Visual C++ IDE
===> C++ Misc.
===> C
=> Computer Science
===> Algorithms
===> Computer Architecture
===> Graphics 3D
===> Neural Networks
===> UML
===> Development
=> Web Programming
===> PHP
===> HTML
===> CSS
===> Flash
===> Actionscript
===> Java
===> JavaScript
=> Math
=> Physics
=> English
=> Music
=> Children's
=> Software
=> Catholicism
=> Other
===> Puzzles and Tricks
===> How To Use a Computer
=> General Information
===> Site Suggestions
===> Off Topic
Loading...