Beginners - August 2018 (Page 14)

Return nothing from a function having a return type
 
I have a class PackageSingleton and got a function getPackage whose return type is another class Package. class PackageSingleton{ Package getPackage() } ...
[4 replies] Last: If you return a pointer you need to think about the lifetime of the ob... (by Peter87)
by AL88
How can I make the class return the entered string
 
Its compiling but not returning anything. How do i return the string from the class. Thanks. #include<iostream> #include<string> #include<vector> #i...
[5 replies] Last: Without defining a default constructor, it is still done basically the... (by Manga)
Define Class as an array
 
Hi Everyone, I am new to C++, so fare I did more than 1000 lines in Clion (resolution of algorithm, use of matrix, inverse matrix and etc..). I was very satisfi...
[2 replies] Last: Thank you tpb. I moved #include "ZY_Cal.h" from main to Input_Data and... (by tghatem)
by clonxy
fstream: reading map
 
I need help using <fstream> to read a file and input the map into a 2d vector The map is: map.txt 9 5 ********* ** **** ** ****** ** u *** ********* The ...
[2 replies] Last: I found the solution. Here it is for people that need it: //David C... (by clonxy)
Calculator pt2
 
I need the loop to continue after "Wrong Expression!" and "Error. Insufficient operators for operands." allowing them to keep entering expressions until they ar...
[4 replies] Last: I know all that, the point of the post is to help me find the other wa... (by sgill1998)
'else' without a previous 'if'
 
Help me fix my else statement #include <iostream> #include <string> using namespace std; int main() { string operation; int userinput; double tota...
[1 reply] : Please format your code so we don't have to... #include <iostream> ... (by SamuelAdams)
Error codes.
 
I tried to figure it out but I am still getting E0065 error codes, and E0020 error codes. I am having trouble defining showMenu, showPrice, ItemPrice, and quant...
[1 reply] : Repaste your code within code tags to preserve indentation: your ... (by tpb)
Reservation Program
 
Good day, i need help with creating a reservation program. Using this scenario: [You are a Software Engineer working in the IT Department (** Resort) You...
[3 replies] Last: #include<iostream> #include<fstream> #include<windows.h> #include<stri... (by Mc Daniel)
user input causes console to flood
 
So i've been messing around with c++ for a bit now, I noticed that if I have an input (whether it be cin, getline, or scanf) within a while loop, if the user en...
[6 replies] Last: Thank you for fixing up my code, I wasn't aware of cin.ignore either. ... (by valkjo1)
by AL88
Trying to write a simple get and set function
 
Hi im a complete noob and im trying to write a simple get and set function for a class of strings. Can someone show me how to do it and i dont want to use a def...
[1 reply] : Why do you keep creating new topics for the same question? Respond to ... (by tpb)
Estimating e using Monte Carlo
 
Hey everyone. I am new to c++. I am really confused as to how to get the estimation of the number e using Monte Carlo. I have searched on Monte Carlo but I stil...
[2 replies] Last: The Monte Carlo method is to use the mean of a large number of experim... (by lastchance)
by Oknel
Need text of void encode( char* buf, int size ); (1,2)
 
Need text of presumably encode.cpp presumably from GCC static library. Known info: void encode( char* buf, int size ); encode( m_buf, m_size ); Need d...
[20 replies] Last: @MikeyBoy I wish I knew. It is inside the project folder that came fro... (by Oknel)
What am i doing wrong?
 
What am i doing wrong im very new to C++ and im just trying some random things. im trying to put a simpel password on the program. #include "stdafx.h" #i...
[6 replies] Last: XD omg ive heard people like apples........ Thanks i supose i need to ... (by TheLent)
by clonxy
class: not reading private variables
 
I need help with my assignment. Some of the objects in my cpp file isn't reading the private variables. Map.h: #ifndef Map_h #define Map_h #include <io...
[6 replies] Last: Thank you Stewbond, that was really helpful. I made the changes. Curre... (by clonxy)
Lottery number generator
 
So if 69 comes out 69 cannot come out again. That's the type of algorithm. How is this code? I feel like this is not following the algorithm it just uses commo...
[17 replies] Last: I found it!! Why my code made duplicates!!! And fixed that som bitch!!... (by Manga)
After import text file, how to separate lines as strings and integers and also how to store only numbers into an array.
 
Hi, As you see i'm a newbie who studies on GEANT4 simulation program. I need an array which has numbers on it for example my_array . The question is, i expo...
[4 replies] Last: If you have access to some common unix tools you can do this: grep "^... (by dhayden)
How could this be done?
 
Hi Below is a section of code that calculates the average of the input that is put into an array. Any number that is in the array is less than average, the cod...
[4 replies] Last: Thanks. I know I didn't give the entire code but I added these lines i... (by NoobToThis)
by AL88
Trying to set a class member string with getline
 
Hi I am trying to build a class of strings so I can experiment with sorting it with std::sort. Why cant i get the setname function to work with getline so i can...
[2 replies] Last: Use a default constructor for this. Example... #include<iostream> #i... (by Manga)
Segment Fault.
 
Receiving a segment fault need help fixing. #ifndef DNODE_H #define DNODE_H template<class Item> class dnode { public: dnode(const Ite...
[14 replies] Last: Excellent! You probably already fixed this, but I was looking at dlist... (by tpb)
else without a previous if error
 
So, no matter what i do, i can't seem to be able to fix this error, could someone please help me? #include <iostream> using namespace std; string input1; str...
[6 replies] Last: Thanks everyone for all the awesome help, it really helps me out. Than... (by Doggo Gamo)
August 2018 Pages: 1... 12131415
  Archived months: [jul2018] [sep2018]

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