-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidTechDemo.cpp
56 lines (49 loc) · 1.27 KB
/
idTechDemo.cpp
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
50
51
52
53
54
55
56
// Demonstration for idTech
// Created by Brennan Sammis
// Do not share with anyone
#include <iostream>
#include <stdexcept>
#include <stdio.h>
#include <iomanip>
#include <string>
#include <cstring>
using namespace std;
int main()
{
int count = 0;
bool isIterating = true;
string hello = "world";
// Note: The array size is 5, this may not always be known
for (int i = 0; i < hello.length(); i++)
{
hello[i] = 'a';
if (i == 3)
{
hello[i] = 'c';
}
}
// Note: (isIterating==True) is the same as (isIterating)
while (isIterating)
{
if (count == hello.length()) // make sure we are still in our array
{
count = 0; // reset the counter
}
else
{
if (hello[count] == 'a') // check arrays current value
{
isIterating = false; // set our while loop to false
hello[count] = 'b';
}
count++; // this can also be count = count + 1;
}
}
cout << "This is my final array:" << endl;
cout <<"Array Values: ";
for (int i = 0; i < hello.length(); i++)
{
cout<< hello[i] << " ";
}
cout <<endl;
}