C++: Changing a for loop to a while loop

given a code such as
#include
using namespace std;

int main()
{
int len;

cout > len;

for (int i = 0; i < len; i++)
{
for (int j = i+1; j < len; j++)
{
cout

Other urls found in this thread:

en.wikipedia.org/wiki/For_loop#Equivalence_with_while-loops
en.wikipedia.org/wiki/Do_while_loop#Equivalent_constructs
twitter.com/NSFWRedditGif

1. this is a brainlet question and if you can't solve this then you shouldn't be programming
2. /g/ is the better place to ask this, in their programming thread or whatever the fuck

You do know there's a stupid questions thread, right?

pls help this is my first programming class and the lecture notes/book aren't helping

en.wikipedia.org/wiki/For_loop#Equivalence_with_while-loops

int x = 0;
while ( x < len )
{
cout #

which one is the outer loop and which one is the inner loop?

>why would you want to?
>all while loops can be for loops
>not all for loops can be while loops

There is only one loop.
Wtf my dude

nvm i figured it out. thx tho

but i was referring to which one that while loop replaces, and how to know which one is outer and which one is inner

if you would be so kind though, I now have to switch the for loop on the outer loop to a do-while. can you spoonfeed me pls? :3

>How would you change the inner loop from a for loop to a while loop without changing the output that would be given?

>for(statement; conditional; incrementation){
>>//... body//
>}

is exactly

>{
>statement;
>>while(conditional){
>>>//... body//
>>>incrementation;
>>}
>}

how do you go from for loop to do-while?

see and en.wikipedia.org/wiki/Do_while_loop#Equivalent_constructs

#include
#include
using namespace std;

int main()
{
int len;

cout > len;

int i = 0;
int j = 1;
while (i

thanks user

These software engineer plebs should be banned from Veeky Forums honestly

lol wimp

Software engineers don't post on Veeky Forums asking how to write a loop

These freshman CS students should be banned from Veeky Forums honestly

bump
this is interesting, was it ever solved???

we own this board