Beginners - January 2019 (Page 8)

by Bopaki
I do not know why string3 is not being displayed here
 
I am adding two strings using an overloaded operator+ //Header file newString.h #ifndef H_newString #define H_newString #include <iostream> using na...
[4 replies] Last: Hello Bopaki, Overall dhayden has the best solution. For what it is ... (by Handy Andy)
Refresh console without printing every time
 
Hi, I'm writing a little game. The "playground" is a matrix and player has to move trough it so I'm questioning if exist a way to refresh the console to visuali...
[2 replies] Last: @mbozzi Thanks a lot for your answer. (by RustyJoe)
Finding new line in string
 
I am Trying to find where there is a new line in a string in order to count which line is being output. So far I have for(int i=0; i<sizeoffile; i++){ if...
[5 replies] Last: Yeah, you're right, of course. I should have looked at the code for mo... (by Cheddar99)
by Bopaki
I want to get a sum of 2 objects
 
I get an error when I try to add two objects like Box3 = Box1 + Box2; #include <iostream> using namespace std; class Box { public: doubl...
[10 replies] Last: Thanks to everybody who assisted me. I got the logic of the situation... (by Bopaki)
by yup2
Vector issues
 
I am having trouble doing the following: 1. Outputting information that has just been entered using cin. 2. Ouputting the position of the vector element. 3. Del...
[3 replies] Last: Hello yup2, What I see is that the first three items use "Vec", you s... (by Handy Andy)
by Grime
Why doesn't class obj(); work?
 
Say you have a structure like so: struct bob { int var; bob() { cout << "You've been initialized."; } }; If you try to declare an object like so...
[7 replies] Last: Well you have some nerve to tell me to be more specific. I provided a... (by Grime)
BG / FG Color
 
What is the color scheme for coding in C++? Like if I want a black background with green text, like those of the monochrome era. How would I come about doing th...
[1 reply] : https://stackoverflow.com/questions/9965710/how-to-change-text-and-bac... (by closed account 42TXGNh0)
Minimax algorithm: tic tac toe
 
I am trying to write an unbeatable ai for tic tac toe game. Everything else is fine but the ai is not playing perfectly. Here is my implementation of minimax...
[2 replies] Last: Ya i got the issues. the whole code was wrong. converting single playe... (by closed account 1vf9z8AR)
Quickly way to push_back 1 to n to std::vector
 
I want to push back 1 to n numbers to a single int vector. Could that be done in one line without loop? std::vector vector(n); // To transform in one lin...
[16 replies] Last: You're right Peter i didn't realise iota would be considered as vector... (by Grime)
Need Help
 
There are M students sitting in a circle and there ID is 1 to M.they started to play a game.Game goes in following manner- There are R rounds.Each round starts...
[1 reply] : Well, a first possible step can be to try to write some pseudo-code to... (by Too Explosive)
Why does a pointer variable to a const char not store address ?
 
Why is the output "12345" and not the address at p since p is a pointer and by definition, pointer is a variable that stores the address? const char* p ...
[3 replies] Last: Thank you, @Ganado and @lastchance . (by Khateip)
Setprecision is not working right ?
 
I hope I don't need to translate the whole code but the thing is for the first meters even tho I use setprecision(2) I get more numbers after the comma "1 meter...
[3 replies] Last: It needs to be done before you print the floating point number col, bu... (by dutch)
by AL88
why doesn't my setw setfill bar graph work
 
why doesn't my setw setfill bar graph work on line 71-74 #include <iostream> #include <string> #include <cstdlib> #include <iomanip> int main() { ...
[2 replies] Last: You only have to set the fill character once, and you probably want to... (by dutch)
Need help with this code.
 
Write a program that asks the user for a positive integer no greater than 15. The program should then display a rectangle on the screen using the character ‘X...
[7 replies] Last: The only problem with your original program is that the cout << endl ... (by dhayden)
Sudoku square problem
 
Hello, i`ve made sudoku project. Problem is in the square. There have been two or three same numbers. Sudoku table before: 0 1 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0...
[4 replies] Last: You should always post your code in code tags: http://www.cplusplus.co... (by dutch)
by yup2
Vector using structure datatype
 
Im having an extremely hard time finding a solution to this, I've looked on youtube and google but have not found a solution. With the followign code I have bee...
[3 replies] Last: My pleasure! glad to have helped! (by H00G0)
Need help reversing a number (Can't get the right answer)
 
I don't get the right answer. I hope I don't need to translate the whole code in English. All I need to do is make a number for example 45 to 54 or 79 to 97. Yo...
[4 replies] Last: In your code, what is the starting value of Apverstas ? Is it meant ... (by Repeater)
Weird Symbols when outputting a char array
 
First off I know there are better ways to deal with strings but in my C++ class the professor wants us to store them in a char array. When trying to output the ...
[9 replies] Last: to print reverse it, you might find strlen() useful. eg for(i = str... (by jonnin)
multiple errors of invalid conversion and previous declaration
 
In this there are conflicting declaration(declared more than once), cannot convert(int* to int)(double* to double)(not sure), and initializing argument(really n...
[4 replies] Last: The biggest problem with your code is that your function prototypes do... (by AbstractionAnon)
by wedb
ultimate tic tac toe, monte carlo scoring, operand and int array conversion problem
 
Full git repository can be found here. https://github.com/WiebedeBoer/mcts_ttt/tree/master/utttbot/utttbot I seem to have a problem that I'm somewhat stuck a...
[1 reply] : Doesn't the best move depend on which player is making it? How does g... (by dhayden)
January 2019 Pages: 1... 678910... 17
  Archived months: [dec2018] [feb2019]

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