-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC++ Loop infinite loops.cpp
More file actions
49 lines (38 loc) · 1.02 KB
/
C++ Loop infinite loops.cpp
File metadata and controls
49 lines (38 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
[AUTHOR]: Saddam Arbaa
[Email] : <saddamarbaas@gmail.com>
C++ program to demonstrate infinite loops
An infinite loop is loop that run forever
infinite loop occurs when a condition always
evaluates to true. Usually, this is an error.
*/
#include <iostream>
using namespace std;
// the Driver Code
int main()
{
/* This is an infinite for loop as the condition
given in while loop is "true" forever */
do
{
cout << "Hell here is infinite loop run forever.\n";
}while (true) ;
//int i;
// This is an infinite for loop as the condition
// expression is blank
/*for ( ; ; )
{
cout << "This loop will run forever.\n";
}
*/
// This is an infinite for loop as the condition
// given in while loop will keep repeating infinitely
/*
while (i != 0)
{
i-- ;
cout << "This loop will run forever.\n";
}
*/
return 0;// signal to operating system everything works fine
}/** End of main function */