I know this is a Lua site, but after 2 Hours of building such a fine structure i will need some tips to make a better layout.
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
void extract(void)
{
int accu = 0;
for(;;)
{
cout << "Enter Number:" << endl;
int su = 0;
cin >> su;
if(su < 0)
{
cout << "Terminated" << endl;
break;
}
else
{
int total = su - accu;
cout << su << " - " << accu << endl;
cout << "Total: " << total << endl;
accu = total;
}
}
}
void sum(void)
{
int accu = 0;
for(;;)
{
cout << "Enter Number:" << endl;
int su = 0;
cin >> su;
if(su < 1)
{
cout << "Terminated" << endl;
break;
}
else
{
int total = su + accu;
cout << su << " + " << accu << endl;
cout << "Total: " << total << endl;
accu = total;
}
}
}
void Expl(void)
{
cout << "Welcome to Byteware TM Sequence Calculator \n" << "End each sequence with a number below zero (0) or Negative (-) \n" << "Please, Choose an Option:\n" << "1 for + \n" << "2 for -" << endl;
}
void opt(void)
{
int op;
cin >> op;
if(op == 1)
{
sum();
}
if(op == 2)
{
extract();
}
}
int main()
{
Expl();
opt();
}

4 comments
Could you briefly explain what this is supposed to be doing? Also note that your code will look MUCH better if you put the opening curly bracket on the line with whatever it belongs to (called cuddling).
Thanks for the tip, it's just a tiny software in which adds or substracts numbers in a pattern.
OOPS: I pasted in the wrong code tomy answer, it's fixed now! My apologies!
It's ok, don't worry.