### sequation

this for make a Sequential
but it says that there is a wrong

 ``1234567891011121314151617181920212223242526272829`` `````` #include using namespace 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<
Last edited on
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.
 ``12345678910111213141516171819202122232425262728`` ``````#include using namespace 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<

i have done all what u told me but a new wrong has found
"Debug Error"
You are using variables a, b and n before they are initialized. Move line 15 between lines 25 and 26.
thx it works :D
but don't as i want i want it in series
Topic archived. No new replies allowed.