Beginners - August 2018 (Page 9)

heap algo modification
 
how can i access each permutation of an array individually found by heap algo? i.e.,permutations of heap algo for {1,2,3} generate 1 2 3 2 1 3 3 1 2 1 3 2...
[2 replies] Last: I'm not sure that's what was asked. A "heap" is just an array that is... (by Duthomhas)
by okfree
Constructing an array
 
If I have an existing array a, and an integer k, how do I create an array such that the i-k to i+k th positions must have exactly a elements smaller than a ...
[5 replies] Last: I'm a little confused by what your asking... If by i you mean the inde... (by Karakuik)
Modulo recursive problem for exponents with decimals
 
EDIT: cleaned out some of the stuff from int main() to make it more readable. Hi, I have an exercise problem where I'm supposed to calculate N!modM where N! is...
[6 replies] Last: Yes, you are right I was overcomplicating, should have thought up of t... (by darkob93)
.exe has stopped working
 
This is my code but when i compile it on codeblocks it says .exe has stopped working after taking input. #include<iostream> using namespace std; int d...
[3 replies] Last: These ones: while(i<t) { length=digits(n,i); in... (by Repeater)
by Ch1156
Ternary operator help
 
I'm looking at the ternary operator and I never used it before but would liek to know how it works, I've been looking at documentation for it but it doesnt say ...
[8 replies] Last: Great! thank you for all your help! (by Ch1156)
by ChrisL
Some basic reasons to start
 
Write your question here. I have started on a question that allowed me to compile but when I went to run it using cygwin or netbeans the program ran and ran wi...
[4 replies] Last: You could get 99 (or any number) if you forgot to initialize count to ... (by tpb)
Spell checker (Programming 3)
 
"Write a spell checker class that stores a set of words, W, in a hash table and implements a function, spellCheck(s), which performs a Spell Check on the string...
[3 replies] Last: std::unordered_map is a hash table. http://www.cplusplus.com/reference... (by tpb)
Program hangs
 
I'm having a hard time figuring out why my program just hangs after I enter my skeleton and human. #include "stdafx.h" #include <iostream> #include <random>...
[4 replies] Last: That one feels backwards to pretty much everyone at first. But when yo... (by tpb)
Adding values in a list with an iterator
 
I'm looking to take the list and instead of going from 0-90 by 10 I would like it to go from 0-90 counting by 5's. However I messed up in my fives_list fun...
[2 replies] Last: Oh wow that was an easy fix thank you very much! (by passiontrip)
coordinate compression
 
Can anyone give me some hint as how to solve this problem: Write some code, post it here. This is not a homework site, nor one to cheat at codechef challenge...
[7 replies] Last: can someone just explain me the test cases.. I am sort of getting the... (by darkX)
by kreezy
My First Project
 
Hello everyone :D I recently made my first C++ project (console app), and I want any feedback you guys want to give me when it comes to the code I produced :...
[6 replies] Last: Thanks a lot from everyone who responded. This project was made withou... (by kreezy)
GCD (1,2)
 
How can we calculate gcd of a^n+b^n and a-b when a,b,n<=10^9 My logic is that gcd(a^n+b^n,a-b)=gcd(a+b,a-b) for every test case this is working...because form...
[22 replies] Last: Just an observation, but... If (a-b) = 0 then GCD = 2a^n. If (a-b)... (by Manga)
GCD
 
Write your question here. Whats problem in my code #include<iostream> #include<vector> #include<math.h> #include<algorithm> using namespace std; ...
[5 replies] Last: @Manga, In gcc <iostream> indirectly includes <string>: <iostream> ... (by tpb)
by clonxy
How do you delete 2d vectors?
 
I tried deleting a 2d vector by using .clear(), but when I tried reloading the Game object, it prints out really weirdly. Game::Game(const std::string &filena...
[1 reply] : If map2d is a vector of vectors, then map2d.clear(); map2d.res... (by Repeater)
std::bad_array_new_length
 
Write your question here. what() is wrong whith this code ? from a famous book I'm reading Put the code you need help with here. class vect { in...
[4 replies] Last: [Hello all, I have reworked Andy's line # 12 from : for (int i = 0;... (by mycuser)
by asdru
->size() returns the wrong result
 
I'm using the ->size() operator to compute the number of elements in an array of strings, but the result is clearly wrong (returns 1 for a 2-element array). Ho...
[4 replies] Last: All of these syntaxes call the size() member function of first std:... (by keskiverto)
Decryption of openssl packets with static certificates
 
I am working on an ethical hacking https://goo.gl/mFYtki project to monitor all the encrypted packets through OpenSSL. I do have both the public and private key...
[no replies]
by Seyter
HOW TO MAKE A PROGRAM THAT ACCEPTS POSITIVE NUMBER INPUT BUT NOT NEGATIVE NUMBERS OR ALPHABETS?
 
HOW TO MAKE A PROGRAM THAT ACCEPTS POSITIVE NUMBER INPUT BUT NOT NEGATIVE NUMBERS OR ALPHABET AND INCLUDES LOOP UNTIL WRONG INPUT IS TRUE?
[8 replies] Last: Also, the usual idea is to write pseudo code first, then turn that int... (by TheIdeasMan)
Default Constructor question.
 
Let's say I have a parametized constructor, and it's the ONLY constructor that should be used, should I =delete the default constuctor or still use =default? ...
[4 replies] Last: Nope not misleading. I appreciate you clarifying for me. I sort of fig... (by CGunn86)
by Kai456
Exception thrown when trying to print only first n elements of vector
 
I can't seem to figure this out. I basically want to first prompt the user how many elements they want, then allow them to input numbers like so: 5 1 2 3 4 5 ...
[6 replies] Last: Wow Ganado thank you for the great reply! Makes a lot more sense now t... (by Kai456)
August 2018 Pages: 1... 7891011... 15
  Archived months: [jul2018] [sep2018]

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