i get problem at this progress

i have worked at it for like a week,and this almos kiled me ,and i still can't work it out. i need some help at this,if u help me worked out i can pay u 20 euro to ur paypal. u can sent me a email if u get interest at it incroyableforce1@gmail.com


#include <iostream>
#include"class.h"
using namespace std;

int main()
{
int a1;
double a5,a8;
cout<<"nombre de pas, et longeur de LH et valeur de h"<<endl;
cin>>a1>>a5>>a8;
aliette A(a1,a5,a8); //
A.CreationSurfacePerimetre(A); //
double** B; //
B=A.creationsysteme(A); //
A.Resolutionsysteme(B,A); //T【0】-T【pas】
cout<<"Evacuée est "<<A.calculeeEvacuee(A)<<"w"<<endl; //


return 0;



#include<iostream>
using namespace std;
#include"class.h"

aliette::aliette(int a1,double a5,double a8)
{
pas=a1; //
E=0.001;
H=0.015;
L=0.015;
LH=a5;
TL=350;
Tair=300;
h1=a8;
r=240;
double *T=new double[3*pas+5]; // n+2temperature surface T[pas+1]-T[pas+pas] n+1 T[2pas+1]-T[3pas] perimetre
/*double *surface=new double[pas];
double *perimetre=new double[pas];*/

cout<<"ok for class aliette"<<endl;
for(int i=0;i<(3*pas+5);i++)
T[i]=0;
for(int i=0;i<(3*pas+5);i++)
cout<<T[i]<<endl;
}

void aliette::CreationSurfacePerimetre(aliette &AL) //
{
int n=AL.pas-1;
for(int i=0;i<(3*n+3);i++) //
cout<<AL.T[i]<<endl;
for(int i=0;i<n+1;i++) //
AL.T[n+2+i]= (AL.L-(AL.L-AL.LH)*(i+0.5)/(n+1))*AL.E; //
cout<<AL.T[n+2+i]<<endl;
}

for(int i=0;i<n+1;i++)
{
AL.T[2*n+3+i]= (AL.L-(AL.L-AL.LH)*i/AL.pas)*2+2*AL.E; //p0, p1, p2, ...pn(p pas-1)
cout<<AL.T[2*n+3+i]<<endl;
}
cout<<"ok creation surfaceperimetre"<<endl;
for(int i=0;i<3*n+3;i++)
cout<<AL.T[i]<<endl;
}
double ** aliette::creationsysteme(aliette &AL) //
{
int n=AL.pas-1;
double **A=new double*[AL.pas]; //
for(int i=0;i<AL.pas;i++)
A[i]=new double[AL.pas];
double constant=AL.h1/AL.r; //
double x=AL.H/AL.pas ;
A[0][0]=AL.T[n+2+0]+AL.T[n+2+1]+AL.T[2*n+3+0]*constant*x*x;
A[0][1]=-1*AL.T[n+2+1]; //s[1]=s3/2 ......s
A[pas-2][pas-3]=-1*AL.T[n+2+pas-2];
A[pas-2][pas-2]=AL.T[n+2+pas-2]+AL.T[n+2+pas-1]*AL.h1*x/(AL.r+AL.h1*x)+AL.T[2*n+3+AL.pas-1]*constant*x*x;

for(int i=1;i<pas-2;i++)
{
A[i][i-1]=-1*AL.T[n+2+i];
A[i][i]=AL.T[n+2+i]+AL.T[n+2+i+1]+AL.T[2*n+3+i]*constant*x*x;//constant=h/r dx =H/n+1
A[i][i+1]=-1*AL.T[n+2+i+1];
}
return A;
cout<<"ok creationmatrice"<<endl;
}

void aliette::Resolutionsysteme( double** A, aliette &AL) //
{
int n=AL.pas-1;
double b[AL.pas];
b[0]=AL.T[n+2+0]; //creer vecteur b
for(int i=1;i<AL.pas-1;i++)
{
b[i]=0;
}
b[0]=b[0]/A[0][0]; //transformer la matriceA
A[0][1]=A[0][1]/A[0][0];
A[0][0]=1.0;
for(int k=2;k<AL.pas-2;++k)
{
double den=A[k-1][k-1];
A[k-1][k-2]=A[k-1][k-2]/den;
A[k-1][k]=A[k-1][k]/den;
A[k-1][k-1]=A[k-1][k-1]/den;
}

A[AL.pas-2][AL.pas-3]=A[AL.pas-2][AL.pas-3]/A[AL.pas-2][AL.pas-2];
A[AL.pas-2][AL.pas-2]=1.0;

b[1]=b[1]-b[0]*A[1][0]; // primere rang
for(int k=2;k<AL.pas-2;++k) // k rang 2<=k<=n-1=pas-2 b=k-1
{
b[k-2]=b[k-2]-b[k-1]*A[k-2][k-1];
b[k]=b[k]-b[k-1]*A[k][k-1];
}

b[AL.pas-3]=b[AL.pas-3]-b[AL.pas-2]*A[AL.pas-3][AL.pas-2]; // n rang (pas-1) on obtien b(0)-b(pas-2)
b[AL.pas-1]=b[AL.pas-2]*AL.r/(AL.r+AL.h1*AL.H/AL.pas);
for( int i=0;i<=AL.pas-1;i++) //donner valeur de T[1] à T[n+1]/t pas
{
AL.T[i+1]=b[i]*(AL.TL-AL.Tair);
}
AL.T[0]=AL.TL-AL.Tair;
cout<<"okcalcule ui"<<endl;

}

double aliette::calculeeEvacuee(aliette &AL) //
{
int n=AL.pas-1;
double summon;
summon=AL.h1*AL.T[pas+1]*AL.LH*AL.E;
for(int i=0;i<AL.pas+1;i++)
summon+=AL.h1*AL.T[i]*AL.T[2*n+3+i]*AL.H/AL.pas;
return summon;
cout<<"ok calcule charge"<<endl;
}
/*void clean(aliette &AL, double** A) //
{
delete [] AL.Tcal;
delete [] AL.surface;
delete [] AL.perimetre;
delete [] A;(*/



#ifndef CLASS_H_INCLUDED
#define CLASS_H_INCLUDED
class aliette
{
private:
int pas;
double E;
double H;
double L;
double LH;
double TL;
double Tair;
double h1;
double r;
double* T;


public :
aliette(int a1,double a5,double a8);//
void CreationSurfacePerimetre(aliette &AL); // creer tableaux surface et perimetre
double ** creationsysteme(aliette &AL); // creer matrice A
void Resolutionsysteme(double** A, aliette &AL); // clculer ui alors calcule vecteurT
double calculeeEvacuee(aliette &AL); // dernier calcule
//void clean(aliette &AL, double**A);
};


#endif // CLASS_H_INCLUDED
Oh, I just love reading unformatted source code in a different language! :D

Right off the bat I noticed you don't have a "}" at the end of your main() function. Rather that, or I'm just blind and can't see it.
ah , i get a powerful help hand. and finally i finish this programe.
Some words of advice:
Run/Debug your program every single time you get to a good "running point" (kind of like stopping at a good "stopping point").
The longer you wait between each bug check, the longer you will likely have to spend searching for it because the more code you will have to go through.

Also, start using an IDE if you can. An IDE would have caught that bug the moment you tried putting it in.
If you are using Windows, I recommend Visual Studios.
If you are using Mac: X code.
If you are on Linux: Code::Blocks.
Though Code::Blocks is usable on all 3, it is usually recommended to use an IDE provided by the company that provides your operating system (at least, that is what I've been told).
Last edited on
Topic archived. No new replies allowed.