I need to write a program where it asks you to input two integers and then it outputs those same two integers, but if you enter '|', it will end the program.
This is what I have, to me it should work, but unfortunately it doesn't.
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
int var1 = 0;
int var2 = 0;
while(1)
{
cout << "Please enter two numbers.\n";
cin >> var1;
cin >> var2;
if(var1 == '|')
break;
else
{
if(var2 == '|')
break;
else
{
cout << var1 << ' ' << var2 << '\n';
}
}
}
}
I'm sure it's some simple concept that I'm missing, but any help would obviously be greatly appreciated.