在这个程序中,我试图取78华氏度并将其返回到Celsius版本和开尔文的类中.但由于一些奇怪的原因,我只是把它作为输出.我究竟做错了什么?
这是我的输出.
78 0 273.15
#include <iostream>
using namespace std;
class Temperature
{
public:
double getTempKelvin();
double getTempFahrenheit();
double getTempCelcius();
void setTempKelvin(double k);
void setTempFahrenheit(double f);
void setTempCelcius(double c);
private:
double kelvin, fahrenheit, celcius;
double c, f, k;
};
int main ()
{
double c, f, k;
Temperature Conv;
Conv.setTempFahrenheit(f);
Conv.setTempCelcius(c);
Conv.setTempKelvin(k);
cout << Conv.getTempFahrenheit() << endl;
cout << Conv.getTempCelcius() << endl;
cout << Conv.getTempKelvin() << endl;
return 0;
}
void Temperature::setTempFahrenheit(double f)
{
f = 78;
fahrenheit = f; …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个while循环,当我选择actres或电影标题时,它存在while循环.但由于某种原因,它不能告诉我,行中有错误while (selecton).有人有想法吗?
string selection;
while ( selection )
{
cin >> selection;
if ( selection == "actress" )
{
cout << "hey" << endl;
break;
}
else if ( selection == "movie title" )
{
cout << "bye";
break;
}
else
{
cout << "Please choose a selection";
}
}
Run Code Online (Sandbox Code Playgroud) 我在编译时遇到这两个错误,但我不明白我做的不对.
main.cpp | 107 |错误:在此范围中未声明'sqrt'
main.cpp | 107 |错误:在此范围中未声明'pow'
#include <iostream>
#include <Windows.h>
using namespace std;
struct Player
{
int x, y;
Player()
{
x = -1;
y = -1;
}
};
struct Ghost
{
int x, y, direction;
Ghost()
{
x = -1;
y = -1;
direction = 1;
}
};
const char SYMBOL_EMPTY = ' ';
const char SYMBOL_PLAYER = '@';
const char SYMBOL_GHOST = 'G';
const char SYMBOL_WALL = '#';
const int MapDx = 10;
const int …Run Code Online (Sandbox Code Playgroud) 我这里有一个代码,可以将您单击的文本输入到下面的文本框中.
但问题是它不会鼠标悬停,它只显示文本符号.
为什么有任何方法可以修复或改变它?或者当你将鼠标悬停在文字符号上时,可以点击它而不是文字符号?
<style type='text/css'>
#navlist {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
#navlist li {
display: inline;
list-style-type: none;
text-decoration: none;
padding-right: 0px;
color: #b7b7b7;
}
#navlist li a {
text-decoration: none;
color: #b7b7b7;
}
#navlist li a:hover {
text-decoration: underline;
color: #b7b7b7;
}
</style>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('a.linkInsert').click(
function(e){
e.preventDefault();
$('#linkText').val($(this).data('value'));
});
});//]]>
</script>
</head>
<body>
<ul id="navlist">
<li><a class="linkInsert" data-value="1">Link (email & IM)</a></li>
|
<li><a class="linkInsert" data-value="2">Direct Link (email & IM)</a></li>
|
<li><a …Run Code Online (Sandbox Code Playgroud) 什么是我可以调用tomorrows日期格式化的PHP函数? 02/04/2014
因此,如果我在2014年2月3日看到该网站,它将显示 02/04/2014
如果我在2014年2月15日看它会显示 2/16/2014
我希望这个循环从我设置的值减少到10到0.为什么它会一直持续下去?
int lengthString = 10;
for (int j = lengthString; lengthString > 0; j--)
{
cout << j;
}
Run Code Online (Sandbox Code Playgroud) 这些文件权限是什么意思?我无法理解它们,我尝试查看 0-7 的含义,但我不确定它们何时在一起。
-r-------x
----rw----
-rwx--x--x
Run Code Online (Sandbox Code Playgroud) c++ ×4
css ×1
declaration ×1
for-loop ×1
html ×1
jquery ×1
linux ×1
php ×1
scope ×1
temperature ×1
unix ×1
while-loop ×1