需要帮助pow10和“访问违规”错误消息 [英] Need help with pow10 and "Access Violation" error msg

查看:75
本文介绍了需要帮助pow10和“访问违规”错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始我的第一个C ++课程并且有一个非常基本的问题。我们要编写一个将使用pow10(int m)函数的程序,我们不要使用数学库中的pow10函数。我不熟悉这个函数所以编写了一个简单的程序来查看它的输出。但是我收到了以下错误。

"您的程序中出现了访问冲突(段错误)。


如果有人能够解释导致这种情况的原因,我会非常感激:)

I''m just starting my first C++ class and have a very basic question. We are to write a program that is going to be using the pow10(int m) function and we are not to use the pow10 function from the math library. I''m unfamiliar with the function so wrote a simple program to see it''s output. I am receiving the following error however.
" An Access Violation (Segment Fault) raised in your program."

If anyone can explain what''s causing this I would greatly appreciate it :)

展开 | 选择 | Wrap | 行号

推荐答案

你的pow10函数调用本身recursivly
you pow10 function calls itself recursivly
展开 | 选择 | Wrap | 行号



你的pow10函数调用本身recursivly
you pow10 function calls itself recursivly
展开 | 选择 | Wrap | 行号


我们程序的说明专门说不使用从数学库中运行,所以我试图...显然不是很明显:)以下是该部分的实际指令..


"函数pow10计算并返回提升到m_th幂的整数10,例如: pow10(3)计算并返回1000.使用for循环计算它。不要在数学库中使用pow功能。

******************************* ******************* ******************************* ********** /

int pow10(int m)"


希望有所帮助......我到处寻找并且似乎无法得到这个......
The instructions for our program specifically say to not use the function from the math library so I was attempting that.. not very well obviously :) Here is the actual instruction for that portion..

"The function pow10 computes and returns the integer 10 raised to the m_th power, e.g. pow10(3) computes and returns 1000. Compute this using a for loop. Do not use the pow function in the math library.
************************************************** *****************************************/
int pow10(int m)"

Hope that helps.. I''ve looked everywhere and can''t seem to get this one..


这篇关于需要帮助pow10和“访问违规”错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆