Beginners - September 2019 (Page 11)

Need help with a simple program!! rolls dice and adds the result
 
Im doing an exercise and almost have it down bur I can't figure out how to get the total of the die rolls to add up. I am new to coding so I don't know a...
[2 replies] Last: You should initialise your variables. int playerOneScore = 0; in... (by salem c)
String Functions
 
I'm currently writing a program that uses string functions. I need some advice/hints on how I can display "Hello World" and its length with myStrcat() in main()...
[2 replies] Last: #include <iostream> #include <iomanip> // for std::quoted int my_str... (by JLBorges)
by orcusb
not understanding dereference and pointers
 
I am studying C++ using a book (Sams's teach yourself C++ in one hour a day) and I'm not really understanding when to use int*, versus &int, and int&& is comple...
[16 replies] Last: I have not figured out how to eliminate providing the parameter yet,... (by Niccolo)
Reasonably simple way to make enum work as an unordered_map key or value?
 
Hi, I have a struct in which I store some info. Part of it is an enum type of class which specifies what type it is: struct token { enum class types {...
[6 replies] Last: Furry Guy, I already did that. Not sure why it wouldn't compile withou... (by SqueakySquirrel)
what does "delete" do for pointers?
 
I am new to the pointer, I am so confused about the "delete" operator. I understand that *ptr1=15 before I delete it. Then after "delete ptr1", why the *ptr...
[5 replies] Last: int pointer = 10; { int memory ; memory = 1234; } //<- this is the de... (by jonnin)
is symmetric to a dollar sign?
 
Tips, advice, suggestions on how to do make symmetric to the dollar sign #include <iostream> #include <string> #include "Stack.h" using namespace std; b...
[2 replies] Last: thanks for the idea involving const char c = '$' and the conditio... (by mdh1559)
by annw3y
Biggest number in every row in 2 dimensional array c++
 
Hey guys can someone help me.. I have exercise which says: in 2 dimensional array find the biggest number in every row and print it.. I find this code but i don...
[2 replies] Last: 21:30: warning: ISO C++ forbids variable length array 'result' [-Wvla... (by keskiverto)
I cant create a "random" number generator.
 
So I'm quite new to c++ and making a Rock Paper Scissors game. First I made it with srand and rand. It worked fine. But when I tried to them with c++11's <rando...
[8 replies] Last: @ Handy Andy, Look at the cplusplus page for std::default_random_devi... (by deleted account xyzzy)
Removing/Replacing the "computer given" functionality of backspace
 
Hello I am trying to make a notepad through linked list. Following is my code (this is a 4D Linked list however, for a start, I am just implementing a Doubly L...
[2 replies] Last: umm, I just added an else condition after my "if" and it apparently is... (by redfury)
Equal or less problem
 
"Hello World" :D I am ashamed to admit, but I cannot figure this out, I haven't found any info on the net, so I decided to come here. My problem here is that, i...
[10 replies] Last: Most people would reasonably write an if statement like this: if (ag... (by deleted account xyzzy)
Building libraries before using them
 
Hi guys, I've compiled a few libraries in the past such a SDL and FLTK but why do you need to compile these libraries before you use them? it's much different...
[13 replies] Last: See, e.g., Colby Pike's "pitchfork layout" for a reasonable project or... (by mbozzi)
Passing 2d dynamic array to function.
 
Hi, I have a 2d dynamic array filled with numbers I read in from a file. I printed the array in main to verify it was good, and it was. I am trying to pass that...
[8 replies] Last: How would a file be read into a vector? Depends on how the data is l... (by deleted account xyzzy)
error: return-statement with no value, in function returning ‘int’
 
Hi everyone, I'm working on this code but I get an error. could someone help me how to fix it? I also put 0 after the return but I don't get any answer. #d...
[2 replies] Last: sixth, ^ is not exponentiation tol = 1e-4;//10 ^ -4; (by ne555)
by BSM
For requesting c++ mini program using only if-else, loops, functions, and arrays, without class.
 
Please, can someone give me a c++ mini-program using only if-else, loops, functions, and arrays?
[2 replies] Last: #include <iostream> #include <cctype> #include <limits> int main() {... (by deleted account xyzzy)
Help with IF
 
The last code I wrote was very similar to this one, with the exception of different formulas. I'm having an issue with the any mass greater than 1000, it displa...
[5 replies] Last: You mean like this? if(weight1 > 1000) cout << "\nTOO HE... (by salem c)
error C2679: binary '<<': no operator found which takes a right-hand operand of type 'std::vector<int,std::allocator<_Ty>>'
 
Hi everyone, I'm new to C++. I've been assigned the following tasks. 1. Choose any two random numbers in the range 3 to 9. 2. Find position of these random n...
[8 replies] Last: Hi lastchance and helios , thank you for your advise. I've improv... (by sarah1993)
main not recognizing my class
 
When I try to instantiate the Patient class in main using the only constructor, passing all made up values, the Patient and the first comma in the argument list...
[6 replies] Last: Thank you so much, Andy and Nicolo, for taking the time to help me out... (by Talavera8)
Time(days, hours, min, sec) Mod
 
I have another code I need to write and I have it completed just about, but I need a thorough explanation, please. Why is this calculation as follows? days =...
[2 replies] Last: Thank you again Salem, you're a great help!!!! (by CodeNovice01)
operator || problem need help!
 
I having trouble to figure || operator work but when I expected it to print 0 but it print 2. I thought I tell it to "if name is 0 and B is 1 it should not prin...
[9 replies] Last: Yes, every position is a character, and space is character. Where "A"... (by Niccolo)
IF statements
 
Hello all, I am working on a code for class and I wanted to do something different. I want to include a range for a BMI calculator without using && or ||. what ...
[1 reply] : You could start with the biggest number then go to a smaller number. E... (by rjphares)
September 2019 Pages: 1... 910111213
  Archived months: [aug2019] [oct2019]

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