解决这个问题的错误是什么? [英] What is the error in the solution of this..?

查看:51
本文介绍了解决这个问题的错误是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是将数字总和精确到0.0001%?



sin(x)= x - x ^ 3/3! + x ^ 5/5! - x ^ 7/7!.......





the question is to sum up the number to 0.0001% accuracy ?

sin(x) = x - x^3/3! + x^5/5! - x^7/7!.......


#include<iostream.h>

class item
{
	int number;
	float cost;

	public:

	void getdata(int a,float b);

	void putdata(void)
	{
		cout<<"number :"<<number<<" \n";
		cout<<"cost :"<<cost<<"\n";
	}

};

void item::getdata(int a,int b)
{

	number = a;
	cost = b;

}

int main()
{
	item x;

	cout<<"\nObject x "<<"\n";

	x.getdata(100,299.95);
	x.putdata();

	item y;

	cout<<"\nobjects"<<"\n";

	y.getdata(200,175.50);
	y.putdata();

	return 0;


}





我的尝试:



尝试了每一个参数名称,参数名称等但没有发生的事情



What I have tried:

tried every thing the paramamter name,argument name etc but didn't happened anmything

推荐答案

你应该学习尽快使用调试器。而不是猜测你的代码在做什么,现在是时候看到你的代码执行并确保它完成你期望的。



调试器允许你跟踪执行逐行检查变量,你会看到有一点它会停止你所期望的。

在Visual Studio 2010中掌握调试 - 初学者指南 [ ^ ]

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html [ ^ ]

https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html [ ^ ]



第一个问题:你的代码缺少与

相关的部分
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]

First problem: your code is missing the part related to
Quote:

sin(x)= x - x ^ 3/3! + x ^ 5/5! - x ^ 7/7!.......

sin(x) = x - x^3/3! + x^5/5! - x^7/7!.......





你能提供更多详情



Can you give more details on

引用:

但没有发生任何事情


这篇关于解决这个问题的错误是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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