Question

I need basic a C++ program that covers ANY of the following concepts:   Smart Pointers, or,...

I need basic a C++ program that covers ANY of the following concepts:

  Smart Pointers, or,

Multithreading, or,

Regular Expressions

OR any GUI based C++ application (preferably using QT) ; FLTK also helps.

Thanks.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Okey, Smart Pointer C++ program--

#include <iostream>

using namespace std;

class SmartPtr

{

int* ptr;

public:

  explicit SmartPtr(int* p = NULL) { ptr = p; }

~SmartPtr() { delete (ptr); }

int& operator*() { return *ptr; }

};

int main()

{

SmartPtr ptr(new int());

*ptr = 20;

cout << *ptr;

return 0;

}

Add a comment
Know the answer?
Add Answer to:
I need basic a C++ program that covers ANY of the following concepts:   Smart Pointers, or,...
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
  • I need to write a program in C that covers this: I need in c language...

    I need to write a program in C that covers this: I need in c language Design a program with a loop that lets the user enter a series of numbers the user should enter -99 to signal the end of the series. after all the numbers have been entered, the program should display the largest and smallest numbers entered.

  • Hi all, I need help to do a project based on C++ smart pointers. I have...

    Hi all, I need help to do a project based on C++ smart pointers. I have to implement the class template my_unique_ptr which is a pointer management class template. Also, it's required to implement the following public methods: a. Default constructor that initializes the object to point to nullptr. b. Constructor that takes a pointer Type * as a parameter and sets the object to point there. We say that the newly created object takes ownership of the pointed memory....

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • I need help solving these questions I have the basic concepts down but these are combination...

    I need help solving these questions I have the basic concepts down but these are combination challenge questions that are giving me trouble (a) snow all bunds breaking & forming show the full arrow pushing mach OH N +20 + NH3 (6) Complete the following guithesis. you ONLY have ethyl bromide and ethylamine. Several steps (Make anysning else need for your synthesis from the provided compounds) reasonable synthesis for the following using the given starting material anything ои Sobral gleps...

  • C programming. 1.Create a program that does the following - Creates three pointers, a character pointer...

    C programming. 1.Create a program that does the following - Creates three pointers, a character pointer professor, and two integer pointers student_ids, grades - Using dynamic memory, use calloc to allocate 256 characters for the professor pointer - Prompts the professor for their name, and the number of students to mark. - Stores the professor’s name using the professor pointer and in an integer the number of students to mark. - Using dynamic memory, use malloc to allocate memory for...

  • C++ - How can I implement this function so that it uses smart pointers to release...

    C++ - How can I implement this function so that it uses smart pointers to release any dynamically allocated memory when member variables are destroyed? I want to use unique_ptr to do this. bool CompactStringSet::insert(const std::string& value) { Node* cur = &this->root_; // Start at the dummy "root" node. for (auto character : value) { // For each character... Node* search = this->FindNext( cur, character); // ... find a child containing the character. if (search) { // If such a...

  • I need to rewrite this program using only RIO I/O functions on c 6 Write a...

    I need to rewrite this program using only RIO I/O functions on c 6 Write a C program that asks the user to enter the fil he all its permissions in a readable format.) Also, the program prints the file contents to the standard output if the file is of a regular type. Use only Unix V/O functions. Do not use the O package nor C standard I/O functions. Save your source file as "lab07a.c" and include it in the...

  • HELP NEEDED in C++ (preferred) or any other language Write a simple program where you create...

    HELP NEEDED in C++ (preferred) or any other language Write a simple program where you create an array of single byte characters. Make the array 100 bytes long. In C this would be an array of char. Use pointers and casting to put INTEGER (4 byte) and CHARACTER (1 byte) data into the array and pull it out. Make sure you can access both character and integer data at any location in the array. Read data from a text file....

  • C program that uses pointers as function arguments to do the following: To exemplify pointers, we...

    C program that uses pointers as function arguments to do the following: To exemplify pointers, we will be doing quadratics. Remember that a quadratic expression is of the form: ax2 + bx + c where a. b, c are constant and a is not 0. You will scan in the values a. b. and c. With these values, you will write three functions: quadraticFormula quadraticVertex quadratic Info The first function will perform the quadratic equation to find the roots of...

  • using c++ i need a program like university enrollment, that tell me any information i need,...

    using c++ i need a program like university enrollment, that tell me any information i need, for example if the teacher (administrator) wants to know how many students are on each class he select, in case if the student is trying to access so then the studen put his name on it and select the course and at the end shows how many credits en etc

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