What's is wrong with my code? I cannot see the ouptut

I have been told not to use the system("PAUSE");

But I still cannot see the output.

What am I doing wrong?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#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;
   cout<<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;
  

}
Last edited on
Topic archived. No new replies allowed.