Iv only been learning c++ for two days, so please forgive any noobish errors.
The problem im having is that i cant get the program to deal with numbers longer than 7 characters in lenth without it printing in standard form (it prints 1,000,000 as 1e+06). At first i thought i just needed to use "double" instead of "float", but this hasn't help. I'v changed it now to "long double" and it hasn't helped either.
Im sorry there are no comments, i realy need to get into the habbit of using them. Many thanks in advance.Code:#include <stdio.h> #include <iostream> using namespace std; long double calc(long double num,long double num1,char function, long double neq, char mult, char div, char add, char sub, int cal); int fin(long double neq, int cal); int main(int argc, char *argv[]){ int x; while (x==x){ long double num; long double num1; long double neq; char function; char mult; char div; char add; char sub; int cal; mult='*'; div='/'; add='+'; sub='-'; cout<<"Please enter your calculation, seperated by spaces, and press enter:" <<"\n"; cin>>num >>function >>num1; cin.ignore(); calc(num, num1, function, neq, mult, div, add, sub, cal);}} long double calc(long double num,long double num1,char function, long double neq, char mult, char div, char add, char sub, int cal){ if(function==mult){ neq=num * num1; cal=1;} else if(function==div){ neq=num / num1; cal=1;} else if(function==add){ neq=num + num1; cal=1;} else if(function==sub){ neq=num - num1; cal=1;} else{ cal=0;} fin(neq, cal);} int fin(long double neq,int cal){ if(cal==1){ cout<<"\n" <<neq <<"\n";} else if(cal==0){ cout<<"Operation error, please re-enter your calculation" <<"\n\n"; return 0;}}




