为什么我没有正确的ro答案?
Why i don't have a correct answer for ro?
#include<stdio.h>
#include <math.h>
int main()
{
float pb;
float N;
float ro;
float nb;
printf(" Now we will find the number of charges and users n n n ");
printf(" Please enter the probability n ");
printf(" The probability is ");
scanf("%f",&pb);
printf("n n Please enter the number of circuits N n");
printf("The number is");
scanf("%f",&N);
while ( pb>0.01 )
{
pb=1/(1+N/(ro*pb));
ro=ro+0.01;
}
printf("%f",ro);
}
至少需要初始化不需要从用户读取的所有变量。现在,您正在使用一些"随机"值进行数学运算。
pb=1/(1+N/(ro*pb));
在上面的程序语句中使用ro,并且它没有初始化,所以你的计算没有按照预期结束。
相关文章:
- 欧拉项目#8答案是大以获得有效答案
- 首要问题的答案让值班员搞错了
- C++问题:用户认为数字1-100,程序提出问题不超过6次即可得到答案。无法正确
- 我试图制作一个程序,要求用户输入问题和答案,但程序循环不正确
- 使用 bfs 解决连接组件问题时得到错误的答案
- 同一对象的"sizeof"的不同答案
- 递归求和任务的错误答案
- 我无法在Visual Studio代码中使用CIN输入答案,它说输入您的年龄,但它说只读文本编辑器如何解决这个问题?
- 为什么C++程序在太大时返回代码而不是答案?
- 不理解为什么代码没有产生所需的答案
- 为什么我在代码厨师的 CMPRSS 问题中得到 WA(错误答案)?
- 我的程序将 26 个字母转换为 ascII 没有显示正确答案
- 请找出我的代码中的错误,它在提交得到错误答案的同时仍然适用于我的所有测试用例
- 任何人都可以弄清楚这段代码如何显示运行错误?它打印无限时间 -1 以及正确答案
- C++ 中 pow() 函数的输出没有给出准确的答案
- 函数从指针 c++ 中获取错误的值并返回错误的答案
- 给出不精确答案的递归Karatsuba算法
- 我的 cout 上有一个奇怪的输出,它把答案放在第一位,然后在我调用它的地方放一个奇怪的输出.我该怎么办?
- 对类的未定义引用,常见答案尚未解决
- 为什么我没有正确的ro答案?