Beginners - March 2019 (Page 12)

Reading form a text file
 
How to read values from a text file and store values into a string based on plan from the example below when there are two plans PP and PR. Thus if PP stores th...
[no replies]
by sturk
C++ create constructor that takes 2 arg
 
Hi, I need help with creating a constructor that takes in 2 arguments in <class Line>. I have tried to do it. But it shows a compilation error. I'm not sure abo...
[3 replies] Last: I don't know what your assignment specifies; but inheriting line from... (by JLBorges)
by Ganado
Term for end of the function signature
 
I'm wondering what this thingy that gets attached onto the end of the function signature is called. struct S { void do_thing() const { // ^...
[4 replies] Last: Interesting, never heard the terms before. Thanks all. (by Ganado)
function within switch statement skipping over all cin imputs?
 
Hello, I'm trying to create a program where the menu uses a switch statement and each case has an associated function. The switch statement works correctly, ...
[5 replies] Last: Ok, I think I have it now. For case B: case 'b': case 'B'... (by maine1280)
by connar
Reading a file with mixed data types on each row
 
So I've been working on some code that will read the data off a file, which looks like: 2 apple 1 house 0 3 0 1 shed 0 4 0 3 car ...
[15 replies] Last: That is a simple specialization then. I would store the pieces as a ... (by Duthomhas)
finding the square root with while loop
 
this is the code and it works but I was just wondering if someone can explain how it actually works? I understand that the d is used to output the number to the...
[17 replies] Last: ... if you have a non-iterative solution ... A non-iterative soluti... (by MikeStgt)
User Defined Dynamic Array
 
Hey guys, I am trying to create a user-defined dynamic array like the one in this video (https://www.youtube.com/watch?v=jxpa7QEGojw) I am having a problem co...
[5 replies] Last: It worked!! Thank you guys so much I'm just really curious to know ho... (by Jack Van Stone)
Average and minimum value from Array
 
I'm trying to calculate the average and a minimum value from an array after I create random numbers. I tried a lot of different methods and nothing works. I don...
[4 replies] Last: I get no errors while running in Eclipse. Will check, thank you. (by DrSocha)
Make a Reset() Function
 
I just finished making a hangman game and I can't figure out how to make a reset function #include <iostream> #include <string> #include <vector> #incl...
[4 replies] Last: Hello ChimpCoder, I am not sure what I was thinking at the time, but ... (by Handy Andy)
Sum of vector using iterators
 
Make sure that sum is initialised. If you compile it in cpp.sh it tells you that. int sum = 0;
[5 replies] Last: you can do it with a loop. You should not, but you can if you want to... (by jonnin)
by sturk
C++ class inheritance shapes
 
How do I use my class shape as shown below? Class shape is one that consist of the draw method. But how do I show the inheritance from Class shape to class poly...
[5 replies] Last: For simple school exercises, you could probably get away with Point p... (by salem c)
by AL88
Why is option 1 segfaulting?
 
Why is option 1 segfaulting? Thanks. #include<iostream> #include<algorithm> #include<vector> #include<string> #include<fstream> #include<iomanip> ...
[2 replies] Last: I would start by properly indenting your code, fixing all the compile ... (by jlb)
Programming in natural language
 
Would it be possible to create a programming language from the C ++ code comments? I think of a web page with code search, in which the user searches in natural...
[2 replies] Last: it is intractable to process human to executable. Programming languag... (by jonnin)
unordered_map - Seemingly Random Control Jumps
 
*** Not intended for practical use, just trying to understand why this issue occurs *** There are seemingly random control jumps in this program. After the l...
[2 replies] Last: Thanks for that salem c (by calioranged)
by sturk
C++ compilation issue
 
Hi I am trying to figure out why am I getting some compilation issue with my codes as below? After I tried incorporating class polygon into my line class it gav...
[4 replies] Last: class Line : public Polygon { private: Polygon p1; Polygon p2; ... (by keskiverto)
Removing Leading and Trailing whitespace
 
I am working on project and i am almost finished but the last part of the assignment is to take the user input and remove all leading and trailing white space,...
[5 replies] Last: So i understand what you are saying to do but im not exactly sure how ... (by mxracer321)
by AL88
Why doesn't the spare vector copy into the existing vector?
 
Why doesn't the spare vector copy into the existing vector on line 234? #include<iostream> #include<algorithm> #include<vector> #include<string> #includ...
[6 replies] Last: I misread the parameter, I screwed up. I focused on the position+1. ... (by closed account E0p9LyTq)
by Vetzo
std::vector - mess up its memory management
 
Hello Forum, If I have a std::vector object, and I have 2 pointers to it, and I use both pointers to modify the std:vector object, can I mess up its memory m...
[3 replies] Last: Ok, good. I didn't plan on doing anything strange. Thanks for the res... (by Vetzo)
by AL88
Why doesn't the erase element function work?
 
I'm trying to write a program to manipulate a vector and save it in a text file. All the functions work except the erase element function, lines 371-377. Why is...
[3 replies] Last: Why isn't people.erase(position); working? Because you are supplying... (by closed account E0p9LyTq)
Inches to centimeters loop
 
So I'm supposed to write a program that prompts a user for a two numbers within 36 inches of each other. Use a for loop as a timer. An outer Do While Loop ...
[10 replies] Last: Thank you, JLBorges. (by BIGB185)
March 2019 Pages: 1... 1011121314... 25
  Archived months: [feb2019] [apr2019]

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