I'm making a console application that shows the difference between continue and break when looping. I'm using c++ with visual studio 6.0. I added a new project and in NewProject.cpp I put this together:
// NewProject.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
void ContinueLoop(){
for(int k = 1; k<5; k++){
cout<<"This line shows once per loop cycle\n";
continue;
cout<<"Does this line show?\n";
}
}
void BreakLoop(){
for(int i = 1; i<5; i++){
cout<<"This line shows once per loop cycle\n";
break;
cout<<"Does this line show?\n";
}
}
int main(int argc, char* argv[])
{
cout<<"This is the continue loop\n\n";
ContinueLoop();
cout<<"\nThis is the break loop\n\n";
BreakLoop();
return 0;
}
Now my question is: How do I move ContinueLoop and BreakLoop to a different cpp file that I can call up. I'm pretty new to c++ and the entire idea of having a cpp file and headerfile is new to me (learned a bit of coding in delphi 7 in highschool).
I've looked around, but I can't seem to find what I'm looking for on this site and most answers related are too specific to the situation or have confusing explanations. Give me the noob scrubbed down explanation of how to do this.