Beginners - August 2021 (Page 2)

by siid14
Duplicate Symbol for architecture x86_64
 
(from an old problem, I found a new issue that I did not expect) I have the following error (see output) : Output duplicate symbol 'Rectangle::ya...
[4 replies] Last: I moved the L40 from rect.h to rect.cpp. Ty, it gives me an acceptable... (by siid14)
samples
 
Duplicate topic: http://www.cplusplus.com/forum/general/279580/ PLEASE learn to use code tags, they make reading and commenting on source code MUCH easier. ...
[1 reply] : not quite ¿is there a problem with .getord()? you misunderstood the ... (by ne555)
How to call void from a different class?
 
GUI.cc SomeClass::Dothing(); //A nonstatic member reference must be relative to a specific object SomeClass.cpp class SomeClass { public: void...
[1 reply] : First, minor terminology critique: You don't call 'void', you call a ... (by Ganado)
floating point numbers precision
 
Hello I'm solving some problem with doubles The numbers which I'm using are of order 10^7 I'm getting accuracy errors up to 0.1, how to avoid that My code...
[4 replies] Last: 240 lines is pretty small. Just post the code. (by helios)
confusion on unary_functions
 
//neccessary headfiles are included //"same" function class fun_with{ int operator()(int x){return x+1;}// function object }; auto fun_nwith = (int x...
[2 replies] Last: fun_with is a type. You can't pass a type as a param hence the need to... (by seeplus)
by AkiraC
Favourite number in loop
 
Hi, I want to know how to "mark" the number as favourite number. Let say I enter number 2, and the output will show 2 is the favourite number. I only get to m...
[3 replies] Last: Just a bit of defensive coding: When using any of the scanf functio... (by TheIdeasMan)
Passing pointers* to functions???
 
A little confused when it comes to passing pointers to functions? When you pass by reference &, the function that you pass it to acts on the address & does not ...
[14 replies] Last: Just because a C++ program 'provides the expected output' in one situa... (by seeplus)
by AkiraC
How to trace output?
 
How to trace output of this program? I don't understand how to trace the output It shows 1 0 0 0 0 2 0 0 0 0 3 0 0 0 0 4 #include<stdio...
[3 replies] Last: Use the debugger for your compiler. MS VS has an in-built one within i... (by seeplus)
Weird behavior when using stringstream
 
When I am using string stream twice it does not accept the value second time weird thing is same does work if the string passed before contains a space ...
[2 replies] Last: Thanks for the fast reply that was really helpful! Much appreciated!!! (by kalahan)
Blank output when entering negative numbers
 
Hi we've been given the task to create a program to find out if the number that has been inputted by the user is an even or odd number and if its also a positiv...
[5 replies] Last: Correction: Modulo is implementation-specified for negative operands. ... (by helios)
polymorphism
 
Hi everyone, I'm trying polymorphism for the first time. I'm getting this warning when compiling the codes: warning: deleting object of polymorphic class typ...
[13 replies] Last: I couldn't hope for better. (by Zhylian)
Divination Calendar/I-Ching Program
 
I'm going to say a bunch about what I am doing just in case maybe there is something easier I am only missing, but the point I am at is going into code. I have...
[7 replies] Last: Jeeze, I was so excited I thought of a way to do it, I didn't see it w... (by zEcs Cilnt)
Error: expected primary-expression before ')' token
 
I have encountered a problem with my program. I want to receive a number from the user and then display a triangle with the amount of stars equal to that number...
[3 replies] Last: The error is on L26. A for statement has 3 parts separated by ; (eg as... (by seeplus)
Scope resolution :: woes
 
This is a sample program that teaches us unions & structs. Structs are public access-specifiers by default, so why do I need :: the scope resolution operator wh...
[5 replies] Last: When you say "must be a namespace" you mean the name of functions/met... (by helios)
Password
 
Hi, I'm trying to figure how to read a username and password from a file using a map. I was able to write to the file but I am having difficulties reading the ...
[9 replies] Last: Seeplus and Andy thank you both for all your help. This all helps a l... (by kdrewes)
Retail Item (OOP)
 
Keep getting logical errors. Printing empty output Main File #include "RetailItem.h" #include <iostream> using namespace std; int main() { int ...
[3 replies] Last: See http://www.cplusplus.com/forum/beginner/279521/ Apparently OP did... (by Handy Andy)
for loop exits with out iterating
 
When the maskList() function is called in the "if" statement, the for loop gets bailed on, instead of continuing to iterate like it is supposed to. I can't figu...
[7 replies] Last: @spamfilter - see my 'fixed' code above re prime numbers. There is a p... (by seeplus)
Car Class (OOP)
 
Does anyone know why I keep getting logical errors in my code? Car.h #ifndef CAR_H #define CAR_H #include <iostream> using namespace std; class Car ...
[6 replies] Last: Perhaps: #include <iostream> #include <string> class Car { int ye... (by seeplus)
Issues nesting enum within a struct
 
I am trying to nest some of my enums within structs so that I can use them in functions involving the other struct variables further down the line. I keep getti...
[1 reply] : not having SDL, ... this works: const int LONGBUTTON_HEIGHT = 128;... (by jonnin)
Array - exeption thrown, stack around variable was corrupted
 
What the hell is with arrays, I thought I Am doing that correctly already, but apparently not. It is one of these things I can't wrap my head around... #i...
[6 replies] Last: You can pass an array to a function without it decaying to a pointer. ... (by seeplus)
August 2021 Pages: 1234
  Archived months: [jul2021] [sep2021]

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