Answer:
I know her
she always disturbs my friend =_=
Answer:
if(updateDirection==1){
numUsers++;
}
else if(updateDirection==0){
numUsers--;
}
Explanation:
The if and else if conditional statement above accomplishes this.
if the first condition is true (updateDirection==1), numUsers is increemented by 1 (numUsers++)
else if the second condition is true (updateDirection==0), numUsers is decreemented by 1 (numUsers--)
See a complete C++ code below:
<em>#include <iostream></em>
<em>using namespace std;</em>
<em>int main()</em>
<em>{</em>
<em>int numUsers = 0;</em>
<em>int updateDirection = 0;</em>
<em />
<em>numUsers = 8;</em>
<em>updateDirection = 0;</em>
<em />
<em>if(updateDirection==1){</em>
<em> numUsers++;</em>
<em>}</em>
<em>else if(updateDirection==0){</em>
<em> numUsers--;</em>
<em>}</em>
<em>cout<<"New value is: "<< numUsers<<endl;</em>
<em>return 0;</em>
<em>}</em>
Answer:
class TestPerson : public Person {
private:
string test_name;
int test_age;
char test_gender;
float test_height;
public:
TestPerson (string name, int age, char gender, float height) : Person(name, age, gender, height) {
this -> test_name = name;
this -> test_age = age;
this -> test_gender = gender;
this -> test_height = height;
}
void testSetName() {
test_name = "qwerty";
setName(test_name);
if (name.compare(test_name) == 0)
cout << "Test passed";
else
cout << "Test failed";
}
void testSetAge() {
test_age = 999;
setAge(test_age);
if (age == test_age)
cout << "Test passed";
else
cout << "Test failed";
}
void testSetGender() {
test_gender = 'X';
setGender(test_gender);
if (gender == test_gender)
cout << "Test passed";
else
cout << "Test failed";
}
void testSetHeight() {
test_height = 100.563f;
setHeight(test_height);
if (height == test_height)
cout << "Test passed";
else
cout << "Test failed";
}
void testGetName() {
if (getName().compare(test_name) == 0)
cout << "Test passed";
else
cout << "Test failed";
}
void testGetAge() {
if (getAge() == test_age)
cout << "Test passed";
else
cout << "Test failed";
}
void testGetGender() {
if (getGender() == test_gender)
cout << "Test passed";
else
cout << "Test failed";
}
void testGetHeight() {
if (getHeight() == test_height)
cout << "Test passed";
else
cout << "Test failed";
}
}
most storage servers are based on magnetic hard disks