Beginners - July 2017 (Page 3)

If a Statement happens twice, triggers another statment
 
Im working with a loop and a few if statements within the loop. I'm using rand() % 100+1 to generate a random number, and from that number I'm having different ...
[2 replies] Last: Thanks, that was a lot of help. (by aisakalol)
Including a Header file, does not compile
 
I have my code all set and ready to go but whenever I try to compile, it gives me some errors. I am using Dev C++ since Visual Studio gave me a hard time becaus...
[4 replies] Last: class carddeck { private: const int DECKSIZE; int cardDeck ; publ... (by Enoizat)
Using the this-> pointer or directly calling the method/accessing the variable
 
Just a quick question with this code: class Foo { Foo(); void Bar(); int a; }; Foo::Foo() { a = 10; } To access the 'a' variable within t...
[4 replies] Last: @jlb Yes classes have default private access, however in the snippe... (by longberns)
String handling functions
 
1. Never use gets(). It is deprecated/Removed from C11. Because it is impossible to tell without knowing data in advance, how many characters gets() will re...
[no replies]
Help Please! Error messages with classes.
 
I am writing a credit card simulator that uses classes. On my CreditCard.h file, I am getting error messages on the commented line below. #pragma once #i...
[4 replies] Last: To be more precise, lines 10 and 11 declare the constructors. The act... (by MikeyBoy)
pushback to a vector in a map<int, vector>
 
I have a map <int, vector<object>>, and I want to push back an object to an instance of vector . But I get the error no matching function, here is the sample co...
[1 reply] : The return type of push_back(...) is void hence you cannot use it like... (by coder777)
how to test if a command line argument follows a certain regular expression
 
I would like to test if a command line argument follows a certain regular expression. if it does the boolean isSwitch turns to be true. i tried it 2 differen...
[1 reply] : #include <iostream> #include <string> #include <regex> #include <vect... (by JLBorges)
by i773
How should I go about creating this "Factory"
 
I'm creating a game system and looking at the best way to implement it. I have a bunch of classes and I want to create them in one class after looking at this...
[1 reply] : Make a structure that has both classes and call that structure? May... (by qwertyKeyboard)
by hav206
quadractic probing in hash function
 
I am trying to do the quadractic probing in hashing function. I want to know if this is right? and how do I check if the table is full? // // hash_func.h ...
[no replies]
by xxvms
Unique_ptr
 
Hi there good to see that website if back and running :) I am having difficulty with my project. it is Library with books that can be borrowed by user. t...
[8 replies] Last: yes found that as well :) thank you (by xxvms)
Why cannot compiler find operator<<
 
Why cannot compiler find operator<<?? Where is the compiler looking into to find the definition of operator<< when it encounters the line cout <<f.some_func()...
[8 replies] Last: The function that I want is not a friend since I am not accessing any... (by Cubbi)
digital levelization
 
hello everyone, i'm self-taught c++ programmer,and i have one problem that is for given digital circuit after implementing it i should levelize it with followi...
[3 replies] Last: ok so you need to be sure about that, and if you don't have such a thi... (by jonnin)
Can you sort a deque collection without using any functions?
 
Without using sort() or swap(), how can I sort the deque? I did the usual swapping code one and it did not work... Does it only works on array based list? ...
[2 replies] Last: silly me, all because of a typo (by NGC3370)
by Enaris
Learing cpp from books
 
Hi, I have been reading Primer Plus by Stephen Prata, I have reached end of 14 chapter (which is mainly about class templates). Now I found out that Prata's bo...
[5 replies] Last: The standard library has std::pair<> , we could directly use it. http... (by JLBorges)
how to use regex_serach with dir->path.extension()
 
I am trying to create a program which scans a folder and lists all the C++ files when the user enters a 'c' for argv in the program. for some reason i can't u...
[7 replies] Last: The value type of the filesystem library iterators is directory_entry... (by JLBorges)
Detecting key press for hotkey?
 
How would I detect every key press without listing out every key code from start to finish and not limiting the usable keys to special keys? I want to create...
[1 reply] : Never mind I've figured out how to do it. I thought Keyboard Hooks wou... (by ExSanity)
by Bopaki
I get this error: from 'std::basic_string<char>' to 'bool'
 
Here is the complete error: C:\Dev-Cpp\MAlikChapter1\personTypeDriver.cpp:13:60: error: could not convert 'personType::getLast(std::string) const(std::basic_st...
[5 replies] Last: Thanks to everyone. The program now runs fine and gives the correct ... (by Bopaki)
Extracting email addresses from text file
 
Hi! This program suppose to extract email addresses from random texts However I just can't get it to work, it outputs avocado every time, that if statement had ...
[4 replies] Last: Thank you soooooo much chervil and jonnin!!! Thank you Chervil it work... (by NGC3370)
Polymorphic calls not working!!
 
Shape<---Triangle<---IsoTriangle If I run code below I get the following error IsoTriangle.cpp:36:8: error: no match for ‘operator<<’ (operand types are...
[3 replies] Last: Ah, I see. I wasn't expecting it to be in the IsoTriangle class. When... (by Peter87)
by mmgh
Running MPI on Linux
 
Hello, I have parallelized my code using MPI with the Master-Slave scheme. The code is too big to be written here. I have a problem when I run it on Linu...
[2 replies] Last: Thank you for your reply. I worked on it a little bit more. I think it... (by mmgh)
July 2017 Pages: 12345... 12
  Archived months: [jun2017] [aug2017]

This is an archived page. To post a new message, go to the current page.