does anyone know what the error is?????..........

#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
void mtable(int ,int);

int num,n,prod;

cout<<"\n\n\tEnter the no";
cin>>num;
mtable(num,n) ;
cout<<"\n\n\tEnter the limit";
cin>>n;

cout<<"\n After one call ";
mtable(5,10);
mtable(7,10);
getch();
}

void mtable(int num,int n)

int prod=1;
for(int i=0;i<=n;i++)
  { prod=num*i;
 cout<<"\n"<<num<<" * "<<i<<" = " <<prod;
}

   }

Recommended Answers

All 5 Replies

Prestandard code, a missing curly brace, and using a value before it's defined?

Prestandard code, a missing curly brace, and using a value before it's defined?

i didnt get you!!!!

The stuff in red needs some looking into.

#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{
void mtable(int ,int);

int num,n,prod;

cout<<"\n\n\tEnter the no";
cin>>num;
mtable(num,[B]n[/B]) ;
cout<<"\n\n\tEnter the limit";
cin>>n;

cout<<"\n After one call ";
mtable(5,10);
mtable(7,10);
getch();
}

void mtable(int num,int n)

int prod=1;
for(int i=0;i<=n;i++)
{ prod=num*i;
cout<<"\n"<<num<<" * "<<i<<" = " <<prod;
}

}

The headers are either nonstandard or unused. The main function should return an int. You call a function with an undefined n. The function getch is nonstandard. And your mtable function is missing a matching curly brace.

Also your indentation is lost when you don't use code tags.

EDIT: Dave beat me to it, but read it anyway if you like (apparently I was missing a few things).

i didnt get you!!!!

Firstly, wrap your code in CODE tags, and specify a language (i.e. [ CODE = C++ ], w/o the spaces) so that there are numbers - makes it easier to point out errors.

void mtable(int ,int);

I'm pretty sure function prototypes should be outside of other functions, though I could be wrong about that.

mtable(num,n) ;

n was declared but not defined (i.e. it wasn't initialized). It has no value. Put that line after

cout<<"\n\n\tEnter the limit";
cin>>n;
void mtable(int num,int n)

You need an opening curly bracket after this to start a function.

I believe that's it.

thanks amillion to both of you-dave and cool gamer...i was struggling with that..it was a gr8 help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.