Beginners - July 2018 (Page 9)

Segment Fault help.
 
So I have written a large program and I get it to run for a little bit but it has given me a segmentation fault. I think i`ve narrowed it down to my main.cc it ...
[12 replies] Last: The numbers are probably wrong because you aren't seeking back to the ... (by dhayden)
Adding an interview to the beginning of a string
 
I'm a beginner to C++ and I'm trying to make a program that takes in a user-determined decimal integer number and prints its standard decimal counterpart. The m...
[16 replies] Last: jlb writes: Also the problem may not really be caused by using a std:... (by dhayden)
by Delgeo
main(); called from another function fails
 
Totally lost, i get a "Compiler Error C3861" after trying to restart the app if the end user doesn't want to end the app. Ending seems ok, but the continuing se...
[2 replies] Last: Thank you :-) (by Delgeo)
push_back is not working
 
In the code below, I tried to let the user input text, and it would output the first word. However, whenever I try the program to input the text, it doesn't out...
[2 replies] Last: To be certain that the code will compile cleanly on all conforming imp... (by JLBorges)
strcpy doesn't crash despite not enough char array elements
 
Why doesn't strcpy crash in the following sequence? I have declared a new char array with zero elements into which I am copying 5 characters. #include <i...
[1 reply] : Undefined behaviour does not necessarily result in a crash. Though, w... (by JLBorges)
Spacing in count new lines
 
The program is supposed to output 10 prime numbers per line, and it does. The problem is the spacing varies between the lines. Anyone know how to fix it? #i...
[2 replies] Last: Thank you, once again you helped save me @FurryGuy! (by BGA6444)
Project advice
 
Hi guys I am doing a project as part of one of my college repeats The project is to write an anti virus style type of program,that will take in a file(and fi...
[5 replies] Last: thanks Enoziat I added all the source files from the jansson project ... (by adam2016)
cout prime numbers till 100 using loop
 
The program is supposed to cout prime numbers till 100, however, it just repeatedly outputs 0's. I would greatly appreciate it if someone would help me figure i...
[12 replies] Last: Oh okay. Thank you all so much! This all means a lot to me! (by BGA6444)
by darkX
inverse modulo
 
For each Q, print a single integer in new line denoting inverse modulo of the number of pairs which satisfies the given equation and also present in the given a...
[1 reply] : http://mathworld.wolfram.com/ModularInverse.html I'm not really into ... (by icy1)
It won't generate a new random number each time
 
Im trying to make it so it generates a new number every time, however, it will just generate the highest number #include "stdafx.h" #include <iostream...
[7 replies] Last: Also, for what I can see srand() is going to be re-initialized every ... (by closed account E0p9LyTq)
How to tell wheater vector realloc fails
 
Hey, I'm quite new to C++. I have used C in the embedded world and C#/Java in PC applications. I have a question regarding the vector class. I now that a ve...
[15 replies] Last: Really in such a memory constrained system you should be avoiding new/... (by jlb)
The lifetime of stack-allocated class members
 
Hi, I would like to have class member objects that are not pointers, and be able to initialize them at some point after the container is created. Is this safe ...
[3 replies] Last: As long as your object is alive and in scope, then any member data is.... (by closed account E0p9LyTq)
Need help with small project.
 
I`m going to post the essential code that I think will help fix these problems. I do not have any errors in my code. All of my choices on my menu should be work...
[10 replies] Last: Whats the best way i could get a zip file to you guys? (by sgill1998)
Avoiding circular inclusions
 
Hey guys, If I have a wndproc class and a class A where I want wndproc to inherit the members of class A, normally I would simply declare wndproc as such cla...
[18 replies] Last: Making data members public isn't always the wrong thing to do, but i... (by MikeyBoy)
How do I traverse through a text file?
 
I want to traverse through each line. All I want to do is compare a user input of 4 numbers with each line of numbers from the file. If it matches the user wins...
[5 replies] Last: #include <iostream> #include <sstream> #include <fstream> #include <v... (by lastchance)
Getting WA in GEARS except the first 2 test cases...
 
Can someone give some good test cases for gears?coz I have tried 20-30 cases including edge cases and my code is giving the correct output...I am just going for...
[1 reply] : well, I would help you, but since I don't know where in GEARS problem ... (by Flaze07)
Switch statements
 
Hello everyone, I would like to rewrite this function in a different format using switch statements. Q1 - Is it practical in this example using switch stateme...
[4 replies] Last: void wait_until_TSR_empty() // or whatever while (!TRMT) /* do ... (by mbozzi)
I Need Help
 
This is a function in a program designed to be a very simple musical keyboard. This bit of code isn't working properly and I'm stumped. I'm also open to suggest...
[3 replies] Last: I know that you're probably thinking about how terrible the code on to... (by Code Bean)
Split string that contains delimeter and store into vector pair
 
i have been searching for ages on how to split string that is separated by delimeter and storing them into vector pair. For example, i have a string that con...
[11 replies] Last: An example of how to use a stringstream here at cplusplus: http://www.... (by closed account E0p9LyTq)
why do we want to point to a class?
 
Hi guys, class A{ } int main(){ A a; A*aa; return 0; } I want to know what the difference is between A a et A*aa? Thank you for any help yo...
[3 replies] Last: Thanks Uk Marine. Thanks Ganado for your tutorial. (by heros666)
July 2018 Pages: 1... 7891011... 17
  Archived months: [jun2018] [aug2018]

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