Beginners - August 2016

"expected unqualfied-id before 'if'" Error Assistance
 
I am getting the error "expected unqualfied-id before 'if'" on lines 49 and 54. I tried to fix it but I got stuck. Anyone know the cause of the problem? ...
[2 replies] Last: Programming is hard :( Thanks for the assistance, fixed it right up. I... (by LordApy)
Need help storing pointers into an array
 
I have a homework assignment where i have to use the new operator to store the pointers of InventoryItem objects in an array. Im not sure if im going about doin...
[4 replies] Last: This is what i am at now #include <string> using namespace std; cla... (by kingkush)
Changing Class Methods with User Input
 
Hello, I am very new to programming and C++ so please forgive me for any glaring issues/errors/ and bad code organization and layout. I am creating a class Auto...
[5 replies] Last: Great, thank you very much for those links! (by PadawanProgrammer)
Help with Number guessing Program (Possible Loop Issue)
 
Good afternoon, I am tasked with writing a program that is a number guessing program between 1-1000. The numbers are always the same and in a sorted array. W...
[no replies]
Problems with guessing game assingment
 
Hey I'm doing this project for a class. I'm suppose to be making a guessing game but I keep getting the same errors. Every time I run the program I get an infin...
[7 replies] Last: godofwar53, I put your code in VS2015 and the errors I received dealt... (by Handy Andy)
Printing the file name of an ofstream
 
Hi all, first time posting here so I hope I am doing it correctly. I tried to search for a solution on the web, but with little success. I am looking for...
[2 replies] Last: Hi JLBorges, thank you for your answer. I'll use a separate string va... (by marcodifresco)
by glow
Faster Harmonic Number?
 
I am trying to make a program that given two numbers it substracts one harmonic from the other. (Input: n, m / Output: Hn-Hm) #include <iostream> #include <i...
[1 reply] : "Harmonic number". Is it this: https://en.wikipedia.org/wiki/Harmonic_... (by keskiverto)
Bool
 
Hi guys some questions to bool: Z = !((10 < 20) ^ (5 % 3)) Z = ((5 < 10) - (3 & 1)) == 0; so the first one: I understand that the result will be a NO...
[3 replies] Last: This is a bitwise AND operation. The bits of the two numbers are ANDe... (by AbstractionAnon)
std::map
 
Can someone please confirm if I understand the following code correctly and help me out where I am unable to understand? Thank you. inline void CountFish(int...
[2 replies] Last: What exactly are you trying to accomplish? Unless this is just a sni... (by jlb)
Scope/Stack/Memory Question
 
I wrote a simple program here: #include <iostream> #include <vector> #include <string> class Person{ public: std::string name; ~Person() { std::cout...
[4 replies] Last: Thank you for clarifying. (by EricPlusPlus)
Copy/Move operations for new classes
 
Hi Should a new class always be provided a copy constructor, copy assignment, move constructor and move assignment? Is this true for _all_ of the followin...
[1 reply] : Concrete class: Rule of Zero : Classes that have custom destructors,... (by JLBorges)
by aloz
How to make the program receive a string
 
Hi, I'm trying to make a program that lets the user input one phrase each time and goes counting the number of phrases written, after each phrase it will ask if...
[4 replies] Last: You can try doing it the "C way" (sort of). #include <iostream> #inc... (by JayhawkZombie)
do...while loop
 
Hello guys ok I am terribly bad with loops. There is this question which I do not understand at all. int x = 0; int y = 1; do { y *= 10; //here is also y= y...
[2 replies] Last: #include <iostream> int main() { int x = 0; int y = 1; ... (by JLBorges)
by texagg
RE: Newbie Questions
 
So I am back, learning to write C+ 25 years after I said I hated coding..but that's what life does.. So right off the bat, I get book that's hard to read as ...
[10 replies] Last: I mean like this: int num; cout << "Please enter a number." << endl; ... (by dhayden)
Integer variable not working
 
This is a fairly simple program and everything was fine until i was asked to declare the variable "relays" as an integer after doing so the code does not give m...
[8 replies] Last: @gentleguy So immature lol... What are you saying... step brother? Any... (by boost lexical cast)
Returning a class object by reference inside another class
 
#include <stdio.h> class A { public: void setX(int y) { x = y ;} int getX() { return x; } private: int x; }; class B { public: A& getA ()...
[1 reply] : Please review now and I assume there is no problem in returning object... (by TechEnthusiast)
what is significance of -fPIC flag in gcc
 
I have following file 1) cat my_file.c /* Filename: lib_mylib.c */ #include <stdio.h> int fun() { return 2; } 2)cat my_lib_shared.c #incl...
[1 reply] : man gcc writes: -fPIC If supported for the target... (by keskiverto)
what is the use of gcc -fvisibility=hidden
 
I have a three files 1) cat my_lib.c #include <stdio.h> int fun() { return 2; } 2) cat my_lib_shared.c include "my_lib.h" int foo(void) { ...
[1 reply] : I have multiples files in file.c file2.c file3.c while making the stat... (by TechEnthusiast)
what is happening
 
#include<iostream> #include<cstring> using namespace std; class second{ private: char* text; int count; friend class first; }; class first{ pr...
[10 replies] Last: Indeed, but lets add more water: #include<iostream> class Foo { publ... (by keskiverto)
Feedback for Stack Implementation
 
TextBook Problem: Efficiently implement a stack class using a singly linked list, with no header or tail nodes. The below is my implementation. Please provide ...
[14 replies] Last: Thank you so much! (by mpark4656)
August 2016 Pages: 123... 22
  Archived months: [jul2016] [sep2016]

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