help me plz :D

Joined
Dec 22, 2010
Messages
1
Reaction score
0
i don't know why i can't compile my program , help me the find out plz
here is the code

#include <iostream>
#include <stdlib.h>
#include <conio.h>
using namespace std;
class calcul
{
int nbval, x, *val;
public:
calcul(int,int);
~calcul();
void affiche();
};
calcul::calcul(int nb, int mul)
{
int i;
nbval = nb;
val = new int;
x = 0 ;
for(i=0;i<nbval;i++)
{
val = i*mul;
x = x + val;
}
}
calcul::~calcul()
{ delete val;}
void calcul::affiche()
{
int i;
for(i=0;i<nbval;i++)
{
cout<<val<<" ";
cout<<"\n";
}
cout<<"la somme des elements de la suite est :"<<x;

}
int main()
{
calcul suite1(6,4);
suite1.affiche();
calcul suite1(10,4);
suite2.affiche();
system("pause");
}
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top