Beginners - March 2015 (Page 42)

by Orval
Need help with Classes
 
#include <iostream> #include <string> #include <vector> #include <cstdlib> using namespace std; class Tester { int health = 100; public: int damage()...
[1 reply] : Hi, the statements health; health - 20; do not change any state or... (by Ganado)
Need to improve this code.
 
Thank you, Dhayden. :D
[5 replies] Last: void getSale(int &prod, int &quantity, float &price) The parameters ... (by dhayden)
What can I do to make this functional?
 
What am I missing to get this farenheit to celsius program running? I am almost there but I keep getting this errors. 37 5 \farenheit1.cpp stray '\226' i...
[1 reply] : The "stray" error is from your minus sign not being a minus sign on li... (by tscott8706)
Refreshing the console
 
What is use to refresh the console? I use system("cls") but I think, it doesn't refresh the console. Thanks.
[3 replies] Last: You can't actually "refresh" the console because it doesn't have a vid... (by Computergeek01)
Input validation
 
I am trying to verify that the user only enters R , r , P , p , S , or s. char choice = 0, R = 0, r = 0, P = 0, p = 0, S = 0, s = 0; while((choice ...
[1 reply] : 1.) choice is a character, so it will contain their choice in ascii an... (by GRex2595)
rand function
 
Hey guys, I am writing a rock, paper, scissors program. I've got it pretty much hammered out, except I'm having troubles with the rand function. This is what i ...
[8 replies] Last: Which line? Did you add braces to definition? (by MiiNiPaa)
Pushing back a sprite from a typedef struct
 
How to push back sprites from typed structs? Have tried many combinations, but to no avail. Thx in advance. typedef struct { sf::Sprite* sprite; sf:...
[2 replies] Last: Sorry, I've corrected it. It's about "Units" in SFML, which have a spr... (by Bronislaw)
Own command prompt
 
Hello, I need a help. A want to create method to print the text. Also, i want to create new simple command say(); to print the text. How can i do that please? ...
[2 replies] Last: Instead of cin >> command , you should include string and use getlin... (by GRex2595)
ArrayList Custom class
 
I've made the ArrayList class like in java. This runs fine but when i stores values (i used for loop to store values) it always stores garbage value at index 2....
[4 replies] Last: Thank you very much tipaye and coder777 .... Yours answers mean a lot... (by MRKSalman0349)
trouble with setw and 2D arrays
 
I'm having trouble printing 2D arrays in an aesthetically pleasing manner. When I use the code below, the first row doesn't line up properly with the rest of t...
[2 replies] Last: That's all of the code that I have in main, but the first row isn't al... (by strangelove1221)
by abc456
can someone help me fix this code?
 
...
[3 replies] Last: Where is your original code? Oh wait! I have it right here! // Cont... (by Militie)
Basic looping question confusion
 
The below code works fine, but I believe there is a cleaner way of coding it. I need the program to quit immediately if a negative value for age is entered. Tha...
[4 replies] Last: Got it. Thanks man! (by D0CHollywood)
Spliiting code into headers
 
I just learned how and why to split files into headers. Used it, it made sense and made programming much easier. My question is after I have split my code...
[4 replies] Last: I think I will go for the second option you suggested, thank you for a... (by closed account y0XSE3v7)
dynamic arrays
 
Hey guys, I know what the problem is here, but my question is. Is there a way around this, without using a constant too set the size. int max_rows = 0; ...
[4 replies] Last: Here is an example: int*** my2Darray = new int** ; // create for... (by codekiddy)
Program ends automatically
 
...
[14 replies] Last: Well, you may say that. But you can do other things with targets. For ... (by MiiNiPaa)
LinkedList memory error, help?
 
Hi, so I'm working on a project that requires me to add new nodes to a linked list that I can use to add and remove nodes from the beginning and end of the list...
[3 replies] Last: If _last is the last node with a value == nullptr this line should be... (by closed account SECMoG1T)
How to break loop if my values are arrays
 
Hi guys! I am new using c++ and I want to ask you; How can I break this loop I made if the values I am using are stored in arrays. Also, is the while loop the b...
[2 replies] Last: if(score = score ) This guarantees you an infinite loop, because ... (by tipaye)
A program that assign passengers seats
 
Hi, my assignment is to assign passengers seats in an airplane. assuming the airplane with seat numbering like this: 1 A B C D 2 A B C D 3 A B C D 4 A B C D...
[3 replies] Last: Hmm... that shouldn't really make a difference. If it appears to be so... (by tipaye)
Quick sort
 
Hello, I'm writing code to do a quicksort, however I'm running into problems with stack overflow. This is a question for a homework so I'll have to abide by som...
[1 reply] : Line 12: I don't know how choose_pivot(...) work, but if you pass th... (by coder777)
Simple program to print two squares
 
Hey guys, I was wondering if someone could help me out with my assignment which is two print a total of two squares, a solid and a hollow one , which i have man...
[2 replies] Last: Print first row of hollow square. Print space. Print first row of soli... (by MiiNiPaa)
March 2015 Pages: 1... 4041424344... 51
  Archived months: [feb2015] [apr2015]

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