- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 3
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
20 Posted Topics
Re: If I understand you, console (output window) will close when C++ program ends in Visual Studio. There are many ways to prevent it from doing that here are 2 basic ones. Add one of those 2 lines at the end of your program just above return 0; int x; cin … | |
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; … | |
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 … | |
Re: Here you go few examples of using static members: #include <iostream> using namespace std; class MyClass{ static int counter; public: void print(int& i){ cout << "Number of instances: " << counter << endl; } MyClass(){ print(++counter); } ~MyClass(){ print(--counter); } }; int MyClass::counter = 0; // Static member initialization int … | |
Re: I did, and I got -1 reputation or whatever on that post. So thanks for that as well. http://www.daniweb.com/software-development/cpp/threads/476648/static-data-member-function#post2082150 | |
Re: May I ask why turbo C++? You can create such tool in Visual Studio using C# in less than 2 hours... If you know even a little of C++, C# will be piece of cake in this case. | |
Re: Create file. http://www.cplusplus.com/reference/fstream/fstream/fstream/ Write. http://www.cplusplus.com/reference/ostream/ostream/operator%3C%3C/ And finally click on first link. http://lmgtfy.com/?q=how+to+write+into+file+C%2B%2B | |
![]() | Re: You can hide node constructor body withing tree.cpp file as well. Accessor functions could be const. int Key() const { return key; }; Node* Left() const { return left; }; Node* Right() const { return right; }; void setKey(int aKey) could be void setKey(const int& aKey). Same with 2 addNode … |
Re: Well, I think that your due date expired. > Due date: 30/March/2014, 23:55 pm (through Moodle) | |
Re: If I understand you corectly this should work. #include <iostream> using namespace std; void BubbleSort(int *array, int from, int size, bool decreasing){ bool bDone = false; while (!bDone) { bDone = true; for (int i = from; i != size - 1; ++i) { if (decreasing){ if ( array[i] > … | |
Re: Char "is a simbol" found in ASCII code. If you write your program like this: char c = 'A'; int i = c; cout << c << ", " << cout << i; On the screen you will see: **A, 65** This is called implicit type conversion. All characters can … | |
Re: Here you go. #include <iostream> using namespace std; string printA(int n){ string s = ""; for(int i = 0; i<n; i++) s += " "; return s; } string printB(int n){ string s = "* "; for(int i = 0; i<n; i++) s += "* "; return s; } int … | |
Re: How about you write the code, or at least part of it, and then we help you fixs bugs, give you tips, critics and suggestions? ![]() | |
Re: Why post above mine get -1 vote. It's perfectly fine solution. int a = 10; int b = 20; a = a+b; b = a-b; a = a-b; // or same with -> b=a+b-(a=b) cout << a << endl; cout << b << endl; print out: 20 10 | |
Re: Try this #include<iostream> #include<cmath> #include<iomanip> using namespace std; int main() { double leibniz = 0.0; // pi value calculated from Leibniz double eulerall = 0.0; // pi value calculated from Euler (all integers) double eulerodd = 0.0; // value calculated from Euler (odds) double counter = 0.0; // starting value … | |
Re: > src.substr (0, src.find_last_of ("\\") + 1); What does 0 represent? Starting position? Yes. http://www.cplusplus.com/reference/string/string/substr/ | |
Re: You could use classes to handle contact data. Also you could use linked lists, vectors or such to store those. Finally you still didn't explained what you really want, what's the problem and how should we help? | |
Re: If you place **#include <iostream>** there the program actually works... | |
Re: #include <iostream> #include <cstdlib> #include<ctime> using namespace std; #define ITERATIONS 100 int HEAD; int toss_coin(){ return rand()%2;} int main(){ srand(time(0)); loop: HEAD = 0; // <- You missed such like counter reset! char c; cout << "press H for calling out head or T for calling out tail E for … | |
Re: Here you go. #include <iostream> #include <conio.h> #include <cctype> using namespace std; class Node { public: int data_; Node * next_; }; Node * head = NULL; Node * last_node_ptr = NULL; void Display(); void Createnode(int data_); void Removenode(int data_); void Display() { Node *node_ptr = head; if (node_ptr == … |
The End.