Please Help, I will rate either way because of the effort.
Description: help in c++, this program should have 3 files GuessWho.cpp, Person.cpp, Person.h
-------------------------------------------------------
After completing the program test it with those examples.
Sample Run #1 (bold, underlined text is what the user types):
name haircolor hairtype gender glasses eyecolor hat
----------------------------------------------------------------------
Jane black straight female yes brown no
Feature? name
Jane
Sample Run #2 (bold, underlined text is what the user types):
name haircolor hairtype gender glasses eyecolor hat
----------------------------------------------------------------------
Jane black straight female yes brown no
Feature? haircolor
black
Sample Run #3 (bold, underlined text is what the user types):
name haircolor hairtype gender glasses eyecolor hat
----------------------------------------------------------------------
Jane black straight female yes brown no
Feature? glasses
yesGuessWho.cpp
#include <iostream>
#include <fstream>
#include "Person.h"
#include <sstream>
#include <vector>
using namespace std;
int main() {
ifstream file("people.txt");
string line;
getline(file, line);
file.close();
//split string by whitespace
vector<string> result;
istringstream iss(line);
for (string s; iss >> s; )
result.push_back(s);
if (result.size() < 7) {
cout << "not enough data in line 1";
return 0;
}
Person p;
p.setName(result[0]);
p.setHaircolor(result[1]);
p.setHairType(result[2]);
p.setGender(result[3]);
p.setGlasses(result[4]);
p.setEyecolor(result[5]);
p.setHat(result[6]);
p.printHeader();
p.printFeatures();
string feature;
cout << "Feature? ";
cin >> feature;
if (feature == "name") {
cout << p.getName();
}
else if (feature == "haircolor") {
cout << p.getHaircolor();
}
else if (feature == "hairtype") {
cout << p.getHairType();
}
else if (feature == "gender") {
cout << p.getGender();
}
else if (feature == "glasses") {
cout << p.getGlasses();
}
else if (feature == "eyecolor") {
cout << p.getEyecolor();
}
else if (feature == "hat") {
cout << p.getHat();
}
return 0;
}
Person.h
#ifndef PERSON_H
#define PERSON_H
#include <iostream>
#include <iomanip> //used for setw
#include <string>
using namespace std;
class Person {
private:
string name, haircolor, hairtype, gender, glasses, eyecolor, hat;
public:
void printFeatures();
void printHeader();
void setName(string val);
void setHaircolor(string val);
void setHairType(string val);
void setGender(string val);
void setEyecolor(string val);
void setHat(string val);
void setGlasses(string val);
string getName();
string getHaircolor();
string getHairType();
string getGender();
string getEyecolor();
string getHat();
string getGlasses();
};
#endif
Person.cpp
#include "Person.h"
void Person::printFeatures() {
cout << left;
cout << setw(10) << name << setw(10) << haircolor << setw(10) << hairtype << setw(10) << gender << setw(10) << glasses << setw(10) << eyecolor
<< setw(10) << hat << endl;
}
void Person::printHeader() {
//set field width to 10 char
cout << left;
cout << setw(10) << "Name" << setw(10) << "Haircolor" << setw(10) << "HairType" << setw(10) << "Gender" << setw(10) << "Glasses"
<< setw(10) << "Eyecolor" << setw(10) << "Hat" << endl;
cout << string(70, '-') <<endl;
}
void Person::setName(string val) {
name = val;
}
void Person::setHaircolor(string val) {
haircolor = val;
}
void Person::setGender(string val) {
gender = val;
}
void Person::setHairType(string val) {
hairtype = val;
}
void Person::setEyecolor(string val) {
eyecolor = val;
}
void Person::setHat(string val) {
hat = val;
}
void Person::setGlasses(string val) {
glasses = val;
}
string Person::getName() {
return name;
}
string Person::getHaircolor() {
return haircolor;
}
string Person::getHairType() {
return hairtype;
}
string Person::getGender() {
return gender;
}
string Person::getEyecolor() {
return eyecolor;
}
string Person::getHat() {
return hat;
}
string Person::getGlasses() {
return glasses;
}
Code screenshots
GuessWho.cpp


Person.h

Person.cpp


Input File

Output

Please Help, I will rate either way because of the effort. Description: help in c++, this...
Description: help in c++, this program should have 3 files, TestCat.cpp, Cat.cpp, Cat.h. Write a Cat class to maintain the information about a Cat: name, age, color, furLength, weight. Note that name, color, and furLength are all strings. Age is an integer and Weight is a floating-point numbers. Then write a test program for that class. The test program should read in values for each feature of the cat, set those, and then print them using the Cat’s print method....
This program will make Maze game. Please Help in c++ Prompt the user for a file that contains the maze. Read it into a two-dimensional array Remember you can use inputStream.get(c) to read the next character from the inputStream. This will read whitespace and non-whitespace characters Don’t forget to read the newline character at the end of each line Print the maze to the screen from your array You should include a ‘*’ in your maze to indicate where the...
Please help and follow instructions, c++ , let me know if there is any questions Description: This program is part 1 of a larger program. Eventually, it will be a complete Flashcard game. For this part, the program will Prompt the user for a file that contains the questions – use getline(cin, fname) instead of cin >> fname to read the file name from the user. This will keep you in sync with the user’s input for later in the...
Help c++ Description: This program is part 1 of a larger program. Eventually, it will be a complete Hangman game. For this part, the program will Prompt the user for a game number, Read a specific word from a file, Loop through and display each stage of the hangman character I recommend using a counter while loop and letting the counter be the number of wrong guesses. This will help you prepare for next week Print the final messages of...
Help please, write code in c++. The assignment is about making a hangman game. Instructions: This program is part 1 of a larger program. Eventually, it will be a complete Hangman game. For this part, the program will Prompt the user for a game number, Read a specific word from a file, Loop through and display each stage of the hangman character I recommend using a counter while loop and letting the counter be the number of wrong guesses. This...
Please help in c++, follow the instructions, please. try to use pass by reference and pass by value if you could Description: Write a program that will input wind speed and temperature and output the wind-chill factor. W = 35.74 + 0.6215 ∗ T − 35.75 ∗ V 0.16 + 0.4275 ∗ T ∗ V 0.16 Your program should use at least 2 functions in addition to main. One that uses pass by reference parameters and prompts the user for...
Help needed on C++ program: Program Description: Complete the Ship, CruiseShip, and CargoShip program (#12 in the 9th edition of the text). Read the specific method requirements in the text. Specific Requirements: • Create the Ship class. • Create CruiseShip and CargoShip classes that are derived from Ship. • Create a small tester cpp file that has an array of Ship pointers (one each of Ship, CruiseShip, and CargoShip). The program steps through the array, calling each object’s print method....
//Done in C please!
//Any help appreciated!
Write two programs to write and read from file the age and first
and last names of people. The programs should work as follows:
1. The first program reads strings containing first and last
names and saves them in a text file (this should be done with the
fprintf function). The program should take the name of the file as
a command line argument. The loop ends when the user enters 0, the...
I need help with the following. I need to write a program code in Java using NetBeans. It is from How to Program Java book Chapter 2. This program should calculate the packing of Candles. First read: The number of candles The number of candles that fit in each case Then calculate and print: The number of full cases The number of candles left over (partial case) If this order is large (more than 5 full cases needed) An extra...