#include<iostream>
usingnamespace std;
int addition(int a,int b,int n)
{
for(int g=0;g<=n;g++)
c=a+b*g;
return (c);
}
int main ()
{
int e;
e=addition(a,b,n)
int c;
cout<<"Pleae enter the number of numbers of the sequetial: ";
//لادخال عدد حدود المتتابعة
cin>>n>>endl;
cout<<"Pleas enter first number of the sequential: ";
//لادخال ا
cin>>a>>endl;
cout<<"Pleas enter the basic of sequential: ";
//لادخال د
cin>>b>>endl;
// الحد العام
cout<<e;
return 0;
Line 19, 22, 25: only an output stream(like cout,cerr) makes use of an endl, not an input stream like cin, therefore it should be cin>>n; and cin>>b;
From Line 11 downward: variables n,b,a were not declared.
Note that: the declaration of parameters a,b, and n on line 4 isn't the same as in function main, declare them in main() again.
In function addition, variable c was not declared in this scope. declare it before your for statement.
#include<iostream>
usingnamespace std;
int addition(int a,int b,int n)
{
int c;
for(int g=0;g<=n;g++)
c=a+b*g;
return (c);
}
int main ()
{
int e,a,b,n;
e=addition(a,b,n);
cout<<"Pleae enter the number of numbers of the sequetial: ";
//لادخال عدد حدود المتتابعة
cin>>n;
cout<<"Pleas enter first number of the sequential: ";
//لادخال ا
cin>>a;
cout<<"Pleas enter the basic of sequential: ";
//لادخال د
cin>>b;
// الحد العام
cout<<e;
return 0;
}
i have done all what u told me but a new wrong has found
"Debug Error"