Beginners - December 2018 (Page 5)

by Bopaki
I am battling to write this function
 
This is the algorithm given in the textbook: 1. Initialize sumVotes, largestVotes, and winLoc to 0; 2. Retrieve the candidate's name and relevant data. a....
[3 replies] Last: 1. Initialize sumVotes, largestVotes, and winLoc to 0; Your code in... (by dhayden)
Question about pointers..
 
Write your question here. #ifndef Trump_hpp #define Trump_hpp #include <stdio.h> class Trump{ private: int age; public: Trump(int age){ ...
[2 replies] Last: Oh.. now it's all clear.. thank you!!!! (by vittorioc98)
Linear Search in array
 
Hye guys! I need your help in this code. It's not working. P#include <iostream> using namespace std; int main () { int x,arr ,key; cout << "Ente...
[3 replies] Last: Never trust the user. Validate input somehow. std::cout << "Enter the... (by keskiverto)
Error message
 
I am trying to make an error message for every negative number its used but i cant do that can someone help me please, thanks! #include <iostream> usin...
[2 replies] Last: I dont know what i did here but the code works fine without the error ... (by Mr potato19)
Convert ArrayVector<string> into ArrayVector<char>
 
Hello! So i'm working on a Hangman Game using ArrayVector Data Structure. The goal at the moment that im trying to achieve is to pick a random number from a ...
[5 replies] Last: #include <iostream> #include <string> #include <vector> #include <cct... (by JLBorges)
array cout
 
hello world! if i have array let say map[5]={0,0,1,2,3]}; And I want to count with 0=@@ @! 1=## ## 2=$$ &* 3=** ** Result as @@@@##$$*...
[14 replies] Last: Very clean, nice dhayden. (by Ganado)
Clearing a 2d pointer vector of class objects
 
Hello, How do I clear a 2d pointer vector of class objects. Ex: std::vector< vector<SttHit*>* >* vec_layer; vec_layer->clear(); or vec_layer->erase (vec...
[8 replies] Last: Turns out my code works without using pointers. Thank you very much f... (by AkshayMalige)
Problem with operator= in template
 
I am trying to write operator= in a template class but it can not recognize it. template <class T> class Matrix { int i, j;//rows and columns T **p; publ...
[2 replies] Last: Yeah, thanks. (by Zivojin)
Switch statement looping
 
This is my switch statement looping (that i found on google) where ask users to enter numbers from 1 to 4, if users entered other numbers then loop back, but th...
[2 replies] Last: If the user enters something other than an integer, then n1 will remai... (by dhayden)
Capital of hills
 
Question- Sunderland capital consists of n hills, forming a straight line. On each hill there was a watchman, who watched the neighbourhood day and night. I...
[3 replies] Last: [quote=ne555]going to guess that the upper limit should be 1000000 Bi... (by Enoizat)
How to stop LMB clicker on physical release LMB
 
Hello, I want to create a clicker. I have a hotkey (R+LMB to start loop, release R and still hold LMB to clicks spam) but I dont know how to pause this loop on ...
[18 replies] Last: But still have to use "while" loop to check "press" function. void ... (by jacapiwsko)
n-ary tree
 
hi guys, i should write a code that creates a tree with arbitrary number of children (every child has pointer to its parent), to support insert a node. is this ...
[7 replies] Last: Right, thanks! Correcting it now; use std::list as std::deque won'... (by JLBorges)
Char * to string
 
Hello.Does a char* needs to be const if I want to do char* c="Hello",or it can just stay like this.In my exercise I need to make some variables that are only ch...
[4 replies] Last: Thank you very much for your help. (by Zivojin)
by bcg32
Permuted index question from accelerated c++
 
Hello, in the book accelerated c++ , chapter five-question 1- we are asked to write a program that get input of a few sentences and write the output accordin...
[no replies]
by owmn
Help With Linked Lists
 
Derive the class intLinkedList from the class unorderedLinkedList as follows: class intLinkedList: public unorderedLinkedList<int> { public: void spl...
[5 replies] Last: One thing that most people will miss: you should empty out evensList a... (by dhayden)
funcion help
 
i'm doing sokoban with c++, with level select, i found out that i only can declare map at global, am i able to create function with function in it? exp void m...
[4 replies] Last: thanks Handy Andy and salem c, i had made an progression on my program... (by blacksjacks)
stacks and queues
 
Problem- You are given a stack of N integers such that the first element represents the top of the stack and the last element represents the bottom of the sta...
[10 replies] Last: @salem c actually, I did learn a lot. What I was doing was correct but... (by closed account 1vf9z8AR)
How to call static function
 
Dear experts, I am coming from Java and I am learning C++ currently. In java you have so called "static methods" than can be called without having a class...
[8 replies] Last: Hello coder777, Hello Ganado, Thank you again for your hints. I never... (by peterwa)
by Grime
Where do I start? Sound to frequency
 
I want to make a program that converts sound from a sound file format to a bunch of beeps with respective frequency. For example, I can convert the buzzing o...
[3 replies] Last: Not speaker. A beeper that is only capable of sending frequencies. I h... (by Grime)
Initialize class in another class
 
#include <iostream> class A{ public: A(const char *name) { std::cout<<name; } }; class B{ public: A objA; B(); }; B...
[6 replies] Last: Thank @Peter87 (by kakaducsy)
December 2018 Pages: 1... 34567... 22
  Archived months: [nov2018] [jan2019]

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