English 中文(简体)
我如何解决C++中这一中程方案拟订问题
原标题:How can I solve this median programming problem in C++
  • 时间:2009-11-24 22:05:07
  •  标签:
  • c++
  1. Formulate the steps of identifying the median from five unique numbers and visualize them in flow chart.
  2. Develop an application that shows the median after getting five unique numbers from users.
  3. Extend the feature for allowing six unique numbers input and computing the median.

Example:
Input: 5 4 2 1 10
Output: Median = 4

我在Problem Solving with C++ by ntt_athr_dp_sr_1?_encoding=UTF8&sort=relevrank&search-alias=books&field;以及Wauthor=%20Savitch=tt=t=t=trerel=t= 谁能向我解释?

最佳回答
问题回答

谁能向我解释?

  1. “选择步骤”是指“解释如何做到这一点”。 例如,想象你向我解释如何解决这一问题,我不需要使用计算机(我试图用笔和纸张做这件事),我不知道什么是“中间的”。

  2. “开发应用”是指“标准软件”。 该软件需要:(a) 从用户那里获得5个数字(并可能确保数字为“unique”);(b)找到“中间值”(使用先前在第1步中提出的步骤);c)显示其发现的中位。

  3. 你们需要界定什么“中间”意味着哪怕是投入的数量,并相应地改变你们的方案。

我不知道没有人要求用STL作回答,但对于后来来到这里的人来说,这种回答是有用的。

在C++和STL中,有一项称为nth_element的职能,有三个论点。 它将形成一个足以在正确位置上获得第一点元素的集装箱。

例如:

int numbers[] = { 5, 4, 2, 1, 10 };
std::nth_element(numbers, numbers+2, numbers+5);
std::cout << numbers[2] << "
";




相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签