I am using Dev C++ and I have been told not to use the system("PAUSE") because my antivirus was flagging my code. I am using cin.get(); instead, but I still cannot see the output.
What am I doing wrong?
Code:
#include<iostream>
#include<cmath>
#include <limits>
using namespace std;
double series(double , int);
double c;
int n;
int main(){
cout<<"Enter 2 numbers, c and n :";
cin>> c >> n;
series(c,n);
cin.get();
//std::cout << "Press ENTER to continue...";
//std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
return 0;
};
double series(double c, int n){
double term=0;
double sum=0;
for(int i=0;i<=n;i++){
term=pow(c,i) ;
sum+=term;
}
return sum;