Current location: Hot Scripts Forums » Programming Languages » C/C++ » can i get some help here -paramete x never used?


can i get some help here -paramete x never used?

Reply
  #1 (permalink)  
Old 12-10-10, 03:40 PM
axzablog axzablog is offline
New Member
 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation can i get some help here -paramete x never used?

hello i am beginner in c++ now we study function in ch5 from c++ how to program book,
i use Borland C++ version 5.2 and my problem is:

today when i want compile this code:

PHP Code:

#include <iostream>

#include <conio>

int prod(int x);

int main(void)
{
int x=5;
prod(x);
}

int prod(int x)
{
 
int mal=1;
for(
int i=1;i<=5;i++)
 
mal=mal*prod(i);
 return 
0;

compile don't complete and show me this message"Parameter x is never used'
(look to the picture in the url below):
http://img253.imageshack.us/img253/2...sourcecode.png


i am try many times to solve it by many method but without result so i come to you to help me.

/*
i hope someone can help me and all my thank for members of this site
*/
Reply With Quote
  #2 (permalink)  
Old 12-11-10, 04:10 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You're calling the function prod() recursively and infinitely. Try this
PHP Code:

int prod(int x

    
int mal 1
    for (
int i 1<= 5i++)
        
mal mal x

    return 
mal;

Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 01:20 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.