General C++ Programming - November 2019 (Page 3)

a function-definition is not allowed here before ‘{’ token
 
I get this problem when I try to compile my code. After researching, there are 2 possible reasons to get this error. First, I forgot/added some braces. Second, ...
[1 reply] : Lines 46-48 are inside main , that's your oxyAtom function definition... (by George P)
Help
 
For product and xor of two number find and of two number.Problem is for product and xor of two numbers find two number, but if i have and of two number i can so...
[11 replies] Last: This wasn't his first try at wanting us to write the entire code for h... (by George P)
by stav
Give template specialization of base a higher precedence than derivations?
 
Hello, In the below code, is it possible to give the template specialization of A a higher precedence than any derived types of A? class A{}; class B : publi...
[1 reply] : Something like this (SFINAE), perhaps: #include <iostream> #include ... (by JLBorges)
Moving one vector element into another vector?
 
Hi all, I will try to put my question in an example: If I have a vector of card objects mimicking a deck of cards: std::vector<Card>Deck and wan...
[9 replies] Last: Write functions/methods that "make doing the work easy." If I were c... (by George P)
char array as a function returned value
 
how to have a temporary char array in a function as its returned value? like include namespace std; char* nFunction(string& s){ const char* c=s.c_str(); ...
[5 replies] Last: Okay, so you return a pointer from a function. Does it point to somet... (by dhayden)
Structures and for loop
 
Hello everyone, I am new member here. I made this: struct structure { int number; string name; }; int main() { structure a1,a2,a3,a4,a5 ...
[10 replies] Last: Thank you... problem was <= (by nniks19)
cant read multiple inputs from a file
 
I'm trying to read multiple inputs from the file and seem to be failing can someone tell me what's wrong? ifstream infile; infile.open(filename); if...
[5 replies] Last: for(i=0;i<10;i++) { cout<<temp << " "; } Reading ... (by lastchance)
I want to know how to fix xmemory0 errors.
 
I changed all the projects that I made yesterday. The purpose of this project is to make food by receiving two ingredients just like the last time. The last p...
[4 replies] Last: Thanks you so much for catching my mistake on line 34. You likely mi... (by George P)
Convert decimal to base and base to decimal program
 
I need to create a program that converts a number from any base to decimal and vice versa. Im getting an error in the code I have so far. Any help would be grea...
[5 replies] Last: [quote=kboeser]Ok i did some rearranging on my program and got it to r... (by lastchance)
The template default
 
What will the template default to if one is declared with it but not supplied when being invoked?
[2 replies] Last: It will default to whatever you told it to default to. e.g. std::unif... (by Ganado)
Printing 5 Non-Duplicate Random Numbers
 
Hello. I am currently studying out recursion for my Intro C++ class. However, I am struggling to understand how to print unique non-repeatable random numbers in...
[1 reply] : Don't call main() . It's a special function that is only to be used a... (by Ganado)
SFML installation
 
Hey everyone, I am trying to set up SFML on my MacBook air 13 inches, but, after I connected SFML and everything, I get built successful and then the following...
[1 reply] : Have you tried How to open an app that hasn’t been notarized or is ... (by Repeater)
printf( ... , comma and then followed by fflush
 
I am sorry to get ones disgrace me on posting C problem in C++ place but really need help for: What is printf( ... comma and followed by fflush(stdout); suppo...
[4 replies] Last: You will find a lot of old code where people use a comma instead of a... (by MikeyBoy)
by stav
overloaded base method not inherited ?
 
Hello, I have the following code: struct Serializable { virtual void Serialize(std::ostream& stream) const = 0; }; struct Foo : public Serializable { int...
[1 reply] : I've tested this & it works fine but i don't really like that the pur... (by mbozzi)
by ZKM
Inhertiance
 
I am learning how to use derived classes using inheritance but am so far unable to declare the derived class without error. I have boiled down my code to demons...
[4 replies] Last: I retained the member data in the two classes since they might not be ... (by George P)
How do I rearrange bits in bitset?
 
I need help with a code that rearranges the bits in bitset. Suppose I write input binary: 11010010011011: the output is: 0000000000000000000000000000000000000...
[2 replies] Last: Exactly!!! (by zaahm18)
Choose 2 ingredients to make 15 foods...
 
I tried to write a c ++ program that would make 15 foods with six ingredients. Of the six ingredients, only two are selected. So, I wanted to make 15 kinds of...
[3 replies] Last: You're welcome. (by MikeyBoy)
Creating deck of card objects
 
Hello all - I have a small card game project due this Sunday that involves creating 2 separate classes: one for card objects(myCard), one for a deck object (myD...
[1 reply] : I don't understand your reference to "inheritance". There's no inherit... (by dutch)
Please help by pointing me the right path for this assignment
 
I have the following assignment: Make a program that is used as an information system for the World competition in Athletics. The program should keep and mod...
[15 replies] Last: Turn on your compiler warnings. You'll find a warning near line 121. ... (by dhayden)
by Agrito
Hollow square
 
Hey everyone i hope your doing all fine. The query that i have is that it is pretty easy to print a hollow square using loop but is thee a way to do the same...
[16 replies] Last: lets try this. it does use something you likely havent seen, the ostr... (by jonnin)
November 2019 Pages: 12345... 8
  Archived months: [oct2019] [dec2019]

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