Beginners - June 2015 (Page 9)

How to decrement a value within a loop?
 
Hello, I'm having quite a bit of trouble with this question. I'm following along with a book and have been scratching my head trying to figure out where I'm goi...
[2 replies] Last: Feel incredibly stupid now. 'i' didn't even need to be present. Markin... (by Hcode91)
by rex21
First output is always wrong in do-while loop?
 
Hello. I'm new to C++. I was just practicing this code and I noticed that even if I input 5 or 1 or 2, the first output result is always wrong in the loop. If I...
[3 replies] Last: Thank you, MiiNiPaa. Actually I initially wrote the code with While lo... (by rex21)
by Xentro
Map/Set iterators not incrementable.
 
So I have the following piece of code: std::vector<std::string> Monsters; for (auto & e : Game::GetGameObjectManager().GetGameObjects()) { if (e.second->Ge...
[10 replies] Last: Ok you fixed it, it was indeed the call of my CheckMonsters function w... (by Xentro)
by calz
Change every four letter word to 'love"
 
Write your question here. #include <iostream> #include <string> #include <cctype> int main() { using namespace std; string one_line, s...
[15 replies] Last: Thank you very much guyz. (by calz)
object variable does not stay the same, why?
 
Write your question here. below you can see that my constractor is giving my object a random number(which i can see when the program runs), but once i call ...
[4 replies] Last: Overall, the rabbit::rabbit( int r ) { int b = r%10; int rabbitAg... (by keskiverto)
by Ch1156
Why doesnt this work?
 
I am trying to get the entire contents of a text file, and i am looking at this push back reference and I copied it almost the same, but It still wont work, why...
[2 replies] Last: ah ok thank you. (by Ch1156)
Trying to understand this program?
 
I'm trying to understand the following program which is given in the tutorials section of this website, under "Pointers to functions". #include <iostream> us...
[3 replies] Last: A function can be implicitely converted to pointer to it. So an addres... (by MiiNiPaa)
Unique Pointers
 
Hi, I'm trying to get some practice with smart pointers (specifically unique_ptr), but my compiler doesn't support C++14 so I cant use make_unique, which is wha...
[2 replies] Last: Use the reset(...) member of unique_ptr: unqSaPtr .reset (new Savings... (by coder777)
clearing c buffer
 
when using scanf, how do i clear the input buffer without using fflush?? im using it in linux and some ways in the internet causes segmentation fault. Thanks...
[1 reply] : http://c-faq.com/stdio/stdinflush.html http://c-faq.com/stdio/stdinflu... (by MiiNiPaa)
How to continue getline, find keywords.
 
I'm trying to read a set of numbers from a large text file, and write them into a second text file. The text I have comes in a zillion blocks that looks like...
[9 replies] Last: never mind, I see you changing the value of a1out and then resetting i... (by SamuelAdams)
Summary of number of times program runs
 
So, I got my program to work, finally. But I just noticed I did it wrong (kind of). Every time the user enters -1 to display the summary the number of additio...
[6 replies] Last: @Elzcode, Here I have used the while loop and only implemented plus ... (by CodeWriter)
array bounds checking while reading data
 
Hello everyone, I have a program I am trying to tackle by breaking it down into workable parts, the program is complete but has an issue I can’t figure out....
[2 replies] Last: Thank you so much!! By adding that other flag, solved everything. Than... (by jpanther)
by nofish
const char*
 
Hello, new member here currently learning C++ in self study. I have the following code: const char * pchar = "123456789"; cout << pchar << "/n"; // ...
[9 replies] Last: - pchar 0x00417838 "123456789" const char * 49 '1' const char (by Dmytro)
Member initialization lists in composition?
 
Why is it necessary to use member initialization lists when doing class composition? Is that just what the creators of c++ decided the syntax to be, or is there...
[7 replies] Last: Actual or admitted date of birth? Andy (by andywestken)
C scanf error
 
Write your question here. In my code, scanf is keep passing leftover values to next scanf. I already used fflush, but it is not working. I attached both code a...
[no replies]
Program crashes for generated string
 
Here I am trying to implement longest common sub-sequence algorithm for two randomly generated strings. This program gives me expected output for two given stri...
[4 replies] Last: okay :) (by spsrijan)
by madara
string pallindrome
 
i am writing a program of string pallindrome, code is compiling successfully but on running it accepting the string but nothing after that, the output window st...
[5 replies] Last: And remember, variables are not automatically inititlized in C++ so if... (by andywestken)
Help: nested while loop pattern
 
.
[4 replies] Last: Please, do not delete your posts, it is rude for everyone who helps yo... (by MiiNiPaa)
Printing a string of Characters and integers
 
Hello, I was wondering if there is a way to have a program output a string with both characters and integers. What I want to do is create a program that can ...
[3 replies] Last: Why can't you just get the Powershell script to read the file? Or wil... (by andywestken)
June 2015 Pages: 1... 7891011... 32
  Archived months: [may2015] [jul2015]

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