Beginners - June 2018 (Page 11)

Radius of a circle
 
After I put in the radius when I run it, the area and perimeter don't show up. Could someone give me an idea? #include <iostream> using namespace std; in...
[2 replies] Last: thanks (by grider67)
c++ type erasure
 
Hello I have problem in my school work I try to pass in the "Board board" and the Color color to the the Move PlayeMove(const Board& board, Colour c) function,...
[3 replies] Last: Typically, the solution would be to introduce straightforward run-time... (by mbozzi)
Area and perimeter of a retangle
 
When I run it, I can input length and width. It's not outputting the area and perimeter. What am I missing? #include<iostream> using namespace std;...
[2 replies] Last: Thanks for the help (by grider67)
by t009
Why use while(true)?
 
Is there an alternative to using a while(true) loop and why is it useful here? Could (t.kind=='*'||'/') be used instead? instead of this "while(true)" whi...
[6 replies] Last: Ok I understand now. I just didn't understand. I saw that a return in... (by t009)
Circumference, area, radius of a circle
 
Trying to remove the declaration of RADIUS. Need to add a variable declaration inside main() for a variable named radius. Initialize radius to 5.0. Does th...
[1 reply] : yes. looks like int main() { ... double radius = 5.0; ... (by jonnin)
Finding 2 Largest Numbers in Array
 
This code doesn't find the 2 largest numbers, instead returns 2 numbers in the millions range, not sure why? #include <iostream> #include <vector> usi...
[6 replies] Last: OK, split them in pairs as you are doing (or would be once you fix you... (by lastchance)
Help with creating hotel bill
 
I am trying to create a code that will create a hotel bill. The program shall prompt the user for some numerical values, read in those values, include those val...
[3 replies] Last: If I were to do it I'd use the Boost Date_Time libraries https://www.b... (by closed account E0p9LyTq)
by H00G0
Question on the limits include. What does this statement mean?
 
inventoryDataFile.ignore(numeric_limits<streamsize>::max(), '\n'); inventoryDataFile is an fstream object. Can you explain to me in detail what this...
[5 replies] Last: Thanks a lot to you two! This made things much cleared even if it wasn... (by H00G0)
by Drauka
Codeblocks global compiler settings
 
Hello All, I am new to the forum and have a question about an article http://www.cplusplus.com/doc/tutorial/introduction/codeblocks/ Under that link is a ...
[3 replies] Last: @Drauka, One thing to understand about the tutorial here at cplusplus... (by closed account E0p9LyTq)
reconstruct a vector to user defined class
 
Hello everyone If we have two normal distribution n1(2, 1) , n2(3, 1) and add this two as result we derive N(5, 2). but if we take samples of n1 and n2 CD...
[5 replies] Last: > compare the moments how to find the mean(first moment) and variance(... (by ETH11674)
c - displaying X made out of 1s with a matrix
 
Ok, so I want to print an 8x8 X made of 1s with a matrix. The output should look like this for example: 1--------1 --1----1 -----1 --1----1 1--------1 Though,...
[10 replies] Last: Ah, I completely missed the odd-width cases, but the bitwise-or'ing is... (by lastchance)
by jamos
Saving Game Function
 
Hello, I'm trying to implement a save and load game feature for my 2 player 10x10 grid text based Battleships game. Tried scouring around the internet and...
[7 replies] Last: How does the save function actually get triggered That's up to you. ... (by tpb)
Hi. New to C++ and using youtube tutorials
 
Hi. I'm hoping I can find some help here. So... I'm watching this youtube channel, "Trevor Payne, Let's Learn C++", episode 4 of basics: https://youtu.be/5u6Oq...
[16 replies] Last: there are tutorials right here at cplusplus, not updated to C++14/17: ... (by closed account E0p9LyTq)
Printing prime numbers between 3 and user input
 
Trying to make the program ask a user for a number and then the program is to print out all he prime numbers between 3 and the input number. This is printing bu...
[3 replies] Last: Thank you for the input. I managed to get it done by using a code I fo... (by lkordich)
Help needed regarding class files
 
So, I am the first to admit, I do not know how to word this that it may make sense to a seasoned C++ programmer. But I will do my best. I am trying to make a ...
[11 replies] Last: Thank everyone who helped with this very much. I had tried some of th... (by smaeder)
C++ Store Object to index from an Array
 
Hello, can you help me with this question. A store () method gets an object, calculates an index for the array using getKey () modulo size, and stores the obje...
[8 replies] Last: 1) Please use code tags when posting code, to make it readable. 2) ... (by MikeyBoy)
by gdz98
Jumping into C++ cha 17 number 4 (binary trees and checking)
 
Hi guys I m going trough the Jumping into C++ book and im currently "still" (for who knows me xD) on the binary tree chapter. There s an exercise that tells me ...
[2 replies] Last: no it isn't sorry.... I wrote and "sorting" but that was from another ... (by gdz98)
by gdz98
Jumping into C++ cha 17 number 3 (binary tree and checking balance)
 
Hi guys, i'm still going through the binary tree chapter of my book, and in this exercise i' m supposed to create binary tree of nodes and give the user the pos...
[7 replies] Last: You're welcome - glad I could help! (by MikeyBoy)
by gdz98
Jumping into C++ cha 17 number 2 (binary tree and counting nodes)
 
I m in the middle of this exercise of Jumping into C++. The chapter is about binary trees and I have to build a program that let the user insert as many values ...
[3 replies] Last: oh. it crashes becase if (!tree) { node* new_tree = ne... (by jonnin)
Counting/returning number of files in a folder?
 
The only help I've found online so far to achieve this (storing the number of files in a given folder) is by using the Boost library. I'd rather not include any...
[4 replies] Last: you can ask the OS via 'system' calls using ls or dir (unix, windows) ... (by jonnin)
June 2018 Pages: 1... 910111213... 19
  Archived months: [may2018] [jul2018]

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