49,761 Topics

Member Avatar for
Member Avatar for catastrophe2

hi so why isnt queue printing anything where it should? #include<iostream> #include<string> using namespace std; template<class ItemType> struct NodeType { ItemType info; NodeType* next; }; template<class ItemType> class Queue { private: int size; NodeType<ItemType>* front; // It points to the front of a singly-linked list NodeType<ItemType>* rear; // It points …

Member Avatar for catastrophe2
0
205
Member Avatar for Kristian_2

I have solved it... Shame... -------------------------------- I have problem with this code: cin >> str; smatch m; regex e("([[:w:]]+)@([[:w:]]+)\.com"); //<- Here was the error (it was regex e("([[:w:]+)@([[:w:]]+)\.com");) silly me :(( bool found = regex_search(str, m, e); cout << "m.size() " << m.size() << endl; for (int n = 0; …

0
149
Member Avatar for Gurjot_1

Hi, So I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when the …

Member Avatar for nullptr
0
255
Member Avatar for sunny@123

Using the sample BUBBLESORT program with CHARACTERS given in class do the following: Enter 10 words (does not have to be a phrase or sentence..you may use some digits, caps, and special characters like punctuation. Have each of these words including punctuation entered into a character array. Print out the …

Member Avatar for Ancient Dragon
0
283
Member Avatar for Jake_4

Hello, I am trying to create a tone, then another tone using this code. It currently only plays one of them. Is there something missing or am i going about this wrong? for(int n = 0; n < num_samples; n++) //where n is the step |start of for loop { …

Member Avatar for pritaeas
0
185
Member Avatar for Jake_4

Hello everyone, i am going to create a small tune though i have no idea how to go about it. I currently have a sine wave that plays for one second using a loop similar to this // loop to generate audio samples for(int n = 0; n < num_samples; …

Member Avatar for phorce
0
314
Member Avatar for trantran

I am reading the (otherwise excellent) The C++ Programming Language (4th edition - Hardcover) (Stroustrup) and I cannot understand about 4 pages of it despite a lot of attention to it. It's section 27.4.1 Composing Data Structures starting page 767. After reviewing obviously unsatisfactory alternatives on page 767 for a …

Member Avatar for trantran
0
805
Member Avatar for catastrophe2

hi so i have to make a copy of a linked list i made last week and this time i just have to update it with a deep copy concept thus making a copy of that list i made. here is my code: #include <iostream> #include <string> using namespace std; …

Member Avatar for catastrophe2
0
298
Member Avatar for DS9596

So I have this but I'm not really sure of how to print the smallest element of array `a` , print the sum of all the elements in array `a` , and print the average of all the elements in array `a`. Help please. Is this how to print out …

Member Avatar for nullptr
0
204
Member Avatar for deceptikon

##Why Use Arrays?## Let's begin by considering why arrays might be needed. What is the problem that this feature solves? How does it make your life as a programmer easier? When studying new features, it's important to recognize what that feature does for you and where the incentive is in …

Member Avatar for mike_2000_17
4
753
Member Avatar for vegaseat

This AVI file player has some nice features like adjusting size and speed. The program uses the standard MSvfw32.lib (called libmsvfw32.a in the DevCPP lib directory). Another example of using BCX to translate to C code and modify to something Dev-C++ can handle. Enjoy!!!

Member Avatar for triumphost
0
4K
Member Avatar for lewashby

When I try to compile the program at the bottom this is what I get. `-> qtprogram.cpp:1:24: fatal error: QApplication: No such file or directory` I got this code from a C++ QT book and I'm compiling this on Linux with this command. `-> g++ -g -Wall "${ARG}" -o "${ARG:: …

Member Avatar for JasonHippy
0
145
Member Avatar for PulsarScript

//The code contains 10 distinct syntax errors. //Rewrite the code, correcting all syntax errors. int _tmain(int argc, _TCHAR* argv[]) { int numStamps{4} = {0,0,0,0}; ProcessFileData(numStamps); DisplayDenominationTable(numStamps); double totalCost = CalculateCost(numStamps); cout << "Total cost of stamps is " << totalCost << " euro"<< endline; return 0; } //this is my …

Member Avatar for Suzie999
0
237
Member Avatar for Kristian_2

Hi guys, I have small problem with my example code. Any hint? #include <iostream> using namespace std; class A{ public: int a; A(int i){a = i;} A(const A& rhs) // copy constructor { a = 2; } A(const A&& rhs) // move constructor { a = 3; } }; void …

Member Avatar for mike_2000_17
0
425
Member Avatar for vishalonne

Hello Does every function in C++ returns value? If yes what is that value and what is the use?

Member Avatar for Learner010
0
229
Member Avatar for Rootz

I have been racking my brain for a bit on this and just can't figure it out. The book "Object-Oriented Programming C++" by Joyce Farrell pg382 exercise 13. They're wanting me to make a class named "PlayingCard" that contains 4 fields which are values and suits in both numbered and …

Member Avatar for Rootz
0
485
Member Avatar for agrbinoo.albaker

Write a complete C++ program that reads the attached file (values.txt) to find and print the following: a. The average value of the numbers in the file. b. The maximum and minimum value c. The count of negative and positive values (ignore zero) #include <iostream> #include <cstdlib> using namespace std; …

Member Avatar for agrbinoo.albaker
0
298
Member Avatar for Hector_2

The code isn't displaying and then reversing entered numbers. reverse.cpp // // #include <cstdlib> #include <iostream> #include "linkedStack.h" using namespace std; int main() { linkedStackType<int> stack1; linkedStackType<int> stack2; cout << ""; cout << "output your name\n\n"; int number = 0; // AUSE LINKED STACKS // cout << "Enter first number …

Member Avatar for Hector_2
0
332
Member Avatar for moaz.amin.37

i want to understand that what is bolean data type in c++. I tried to my best but i can not understand boolean data type plz help me

Member Avatar for Schol-R-LEA
0
382
Member Avatar for Mohamed_34

Write a program that can do the following: addition of two matrices . subtraction of two matrices. multiplication of a matrix by a scalar. multiplication of a matrix by a matrix.

Member Avatar for deceptikon
0
142
Member Avatar for Praveen_10

I am trying to write a code that checks if password is pass with the use of functions...but i am not able to ....Please help me i am a beginner....and i need this program to be written strictly using functions....thsnk u in advance

Member Avatar for Praveen_10
0
187
Member Avatar for ravi_14

i am developing a project in c++ and i need database to save details.i googled but so far have bot come across a good tutorial for c++ database . most of the articles i have found are obsolete. please suggest what are APIs for database in c++?

Member Avatar for Ancient Dragon
0
470
Member Avatar for agrbinoo.albaker

Write a program that uses a for statement to sum a sequence of integers. Assume that the first integer read specifies the number of values remaining to be entered. Your program should read only one value per input statement. A typical input sequence might be 5 100 200 300 400 …

Member Avatar for agrbinoo.albaker
1
976
Member Avatar for smitsky

I'm having a problem accessing information between classes. The following simple program illustrates the problem. I have two classes. Int Cell and second. IntCell has a single data member: storedValue. I initialize the value of storedValue to 0, and then assign a value of 16 to it in main() on …

Member Avatar for Ancient Dragon
0
202
Member Avatar for TheFearful

This is the code that I have for inserting a node, but I don't know how to do the delete function. Any tips would be helpful // Constructor Tree::Tree() { root = NULL; } // Destructor Tree::~Tree() { freeNode(root); } // Free the node void Tree::freeNode(Node* leaf) { if ( …

Member Avatar for TheFearful
0
163
Member Avatar for m.a.u.

Greetings everybody, I would like to ask you which C++ libraries you use for ethernet communication? In web I found several; [boost.asio](http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio.html) [Nut/OS](http://www.ethernut.de/api/index.html) [Sockets](http://www.alhem.net/Sockets/index.html) Is there another and easy? By the way, which one of these three libraries are easier to use :) . Thanks in advance

Member Avatar for m.a.u.
0
167
Member Avatar for newbiewwcode

Can you guys please help me understand when to use const? For example, if I have the following functions: viod add (int* array) { int total = array[1] + array[2]; } viod subtract (int* array); viod times (int* array); viod divide (int* array); viod printArray(int* array); and I only intend …

Member Avatar for newbiewwcode
1
203
Member Avatar for beastie805

I got a small program here, I am just trying to return a string value from a function through a reference parameter but I keep getting an error. Any help or tips will be appreciated #include<iostream> using namespace std; int timesTen(int, string&); int main() { int number = 6, product; …

Member Avatar for beastie805
0
447
Member Avatar for m.a.u.

Greetings everybody, I have been develolping a program for isochronous USB communication. In run time, when allocating memory for transfer, libusb_transfer, ENOMEM error arises. I have been looking for a solution for this problem, but I have not come to a conclusion, yet. What might be the reason of this …

Member Avatar for m.a.u.
0
469
Member Avatar for Brandon_6

You cannot determine whether a ctor is being called on an object that is to become const. Such as: const Foo bar( another_foo ); // no way to determine in the ctor that bar will be const I'd like some sort of function attribute for copy constructors to determine if …

0
158

The End.