Question

Create a C++ program to design some sort of object. Examples: Tree, Flower, House, Bike, Sun,...

Create a C++ program to design some sort of object. Examples: Tree, Flower, House, Bike, Sun, Fruit, or just anything.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

// Header Files
#include <iostream>
using namespace std;
// Class Declaration
class Employee{
//Access - Specifier
public:
//Variable Declaration
string name;
int number;
};

//Main Function

int main() {
// Object Creation For Class
Employee obj;
//Get Input Values For Object Varibales
cout << "Enter the Name :";
cin >> obj.name;
cout << "Enter the Number :";
cin >> obj.number;
//Show the Output
cout << obj.name << ": " << obj.number << endl;
return 0;
}

Add a comment
Answer #1

// Header Files
#include <iostream>
using namespace std;
// Class Declaration
class Employee{
//Access - Specifier
public:
//Variable Declaration
string name;
int number;
};

//Main Function

int main() {
// Object Creation For Class
Employee obj;
//Get Input Values For Object Varibales
cout << "Enter the Name :";
cin >> obj.name;
cout << "Enter the Number :";
cin >> obj.number;
//Show the Output
cout << obj.name << ": " << obj.number << endl;
return 0;
}

Add a comment
Know the answer?
Add Answer to:
Create a C++ program to design some sort of object. Examples: Tree, Flower, House, Bike, Sun,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You will create a dimple Bubble Sort program to sort a string of random integers or...

    You will create a dimple Bubble Sort program to sort a string of random integers or text. Please read instructions and examples Please show screenshot of proof that the code works in the C program ECE 216 Programming Project 2 The Bubble Sort You will create a simple Bubble Sort program to sort a string of random integers or text or whatever you can punch in from the keyboard. For the input data, you will input a string of single...

  • Diego’s Bike Lab Lab Objectives • Be able to create both default and non-default constructors •...

    Diego’s Bike Lab Lab Objectives • Be able to create both default and non-default constructors • Be able to create accessor and mutator methods • Be able to create toString methods • Be able to refer to both global and local variables with the same name Introduction Until now, you have just simply been able to refer to any variable by its name. This works for our purposes, but what happens when there are multiple variables with the same name?...

  • Using C++ Create a program that performs the Bubble Sort, the Insertion Sort, and the Selection...

    Using C++ Create a program that performs the Bubble Sort, the Insertion Sort, and the Selection Sort with arrays of varying lengths. You will time each algorithm. The algorithms' time complexities should allow us to predict how these algorithms will perform. Program needs Four separate arrays, each with the same length and filled with the same sequence of randomly chosen numbers. Four separate functions, one for each of the four algorithms. All four functions will need to be timed. Be...

  • Project 4: Tree Sort Develop a C++ program that will recursively alphabetize a set of strings...

    Project 4: Tree Sort Develop a C++ program that will recursively alphabetize a set of strings in a user-specified file using the tree sort algorithm explained in the lectures while maintaining a balanced binary tree at all times. The instructor will test your program with an input file containing: Max Hank Jet Frisky Chata Richard Nan Sam Thomas Karen Gerri Ingrid Alan Dana When done print out the contents of the tree with inorder traversal in a tabular format similar...

  • C++ Program (Linux): Create a bubble sort that can read any list of number from a...

    C++ Program (Linux): Create a bubble sort that can read any list of number from a text file and print them out. Also print the number of comparison (how many time is had to compare number in order to sort).

  • Create a C++ program with the algorithm. Algorithm First Fit Terrance Tao or all elements i...

    Create a C++ program with the algorithm. Algorithm First Fit Terrance Tao or all elements i 1,2,3,...in do for all bins j = 1,2,3.... do . I objects i fits in bin j then pack object i in bin j. Break the top and pack the next object end if end for object i did not fit in any availahe bin then create new bin and Puck object i end if end for. First fit Decreasing Sort objects in decreasing...

  • create and design the ultimate smart home using various senors, in C+ + program

    create and design the ultimate smart home using various senors, in C+ + program

  • Exercise 7.1 (lettercount.py, design). Before attempting to program lettercount.py, create a file called design that includes...

    Exercise 7.1 (lettercount.py, design). Before attempting to program lettercount.py, create a file called design that includes some analysis on how you think the problem will be solved. Examples include: a flowchart of events in the program, pseudocode, or a step by step process written in plain english. If you choose to scan your design please make sure that it is legible. Next write a program that reads in a string on the command line and returns a table of the...

  • Design and implement C/C++ program (myshell5.c) to process command (to tokenize and parse the command, and...

    Design and implement C/C++ program (myshell5.c) to process command (to tokenize and parse the command, and print its components correctly). Your C/C++ program should be able to parse each command from user (to process one command after the other in a loop), until the user's command entered is "exit" to terminate the program. Examples (You may create your own output format or template to show the command(s) being parsed.) Run your program for each of the following examples, to show...

  • I am trying to create a function in c++ that checks if a binary search tree...

    I am trying to create a function in c++ that checks if a binary search tree has duplicate values. It should be very simple and not call any outside values like "data". please use this as a starting point: template<typename X> bool tree_duplicate(tree_node<X>* root) { //code here return true; } I don't need anything else created other then a basic function to tell if the tree has duplicates, and if it doesnt return FALSE. if it helps I have a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT