Beginners - January 2021 (Page 2)

error: expected unqualified-id before ‘return’
I am trying to create a piece of code for an assignment that is due in 17 hours. it needs to be in the style of a gameshow in which a question is asked in code,...
Jan 28, 2021 at 3:44pm
[14 replies] Last: i didnt use all of the feautures i intended on, such as the case secti... (by JackLadYT)
Simple File Copying
I've been trying to figure out a way to simple copy all the files in the current working directory to another folder. I've done this before using system("XCOPY...
Jan 28, 2021 at 2:34pm
[4 replies] Last: The only way I see to do it is the unattractive directory iterator whi... (by jonnin)
stuck in linked list basics
here how head->next is getting address of tail.. nowhere we have specified head->next=tail or head->next=tmp; i understand first call to add() head-> shows...
Jan 28, 2021 at 12:49pm
[9 replies] Last: node(int aa) : a(aa) {} This is a class constructor that takes on... (by seeplus)
Receiving the data from file to the function
I need a small help for my c++ function. I am writing a function called "calculate". The Pr array is a data in a file called "data" and is read from the file p...
Jan 28, 2021 at 12:02pm
[6 replies] Last: Thank you JLBorges, it worked , thank you so much again (by learner999)
Calculate Sinx in C++
Hello, I'd like to calculate sinx with the below formula. My answer is wrong. for example sin(35) is 0.42 but my program gave me -0.42 Formula: https://i.ibb...
Jan 28, 2021 at 10:56am
[11 replies] Last: I know the OP didn't want recursion, but I quite like this method. It'... (by lastchance)
find the sum of numbers in a .txt file
i need to find the sum of rounded to one number after the dot numbers(don't know the right way to call it)(1.63 = 1.6; 3.525=3.5 etc) in a txt file located in t...
Jan 28, 2021 at 10:39am
[5 replies] Last: Thank you!! (by laura fidarova)
Functions
In this program create a one-dimensional array of n random integers from the range [a,b], where n, a,b are given by the user. compute and display how many posit...
Jan 28, 2021 at 10:13am
[2 replies] Last: Consider: #include <random> #include <iostream> #include <limits> #... (by seeplus)
Text Adventure Like Torn.
I have been trying to make a text adventure game based on torn, but with only two choices. Employe and Hacker. Or, if your feeling genourus, maybe add in "Cri...
Jan 27, 2021 at 7:25pm
[3 replies] Last: Note that you could also be using else if chains to prevent redundant ... (by Ganado)
by EmanCS
Reading text file and save in vector
I have a text file consisting of 5 lines. int int int unknown number of int separated by space unknown number of int separated by space This is a sample...
Jan 27, 2021 at 7:02pm
[2 replies] Last: Thank you. It works. (by EmanCS)
by EmanCS
free the memory
Hello How can I free the memory allocated by grid ? int **grid; grid = new int* ; for(int i = 0; i < height; ++i) grid = new int ; for(int i=0;...
Jan 27, 2021 at 6:00pm
[5 replies] Last: Thanks a lot. It works. (by EmanCS)
by munim
how to make a simple college library program.
hello there i want to make a simple college library program in which one can add the information of the book like book name publish day last day and name of th...
Jan 27, 2021 at 1:34pm
[2 replies] Last: A good start would be to declare a struct Book with the required field... (by thmm)
I do not understand "foo.get() = 15" in the code.
I do not understand foo.get() = 15; as the function get has no parameter, what does foo.get() = 15; mean? and why it returns 15? Thanks in advance for...
Jan 27, 2021 at 11:14am
[3 replies] Last: @seeplus @Furry Guy thanks for your replies. (by wanabeahacker)
by Temss
Group numbers
I have numbers in a single array (30,20,25,15,50,30,80..). I want to group all numbers possible in another array without surpassing a total of 80. For example: ...
Jan 27, 2021 at 1:55am
[1 reply] : Is there a reason why (15, 50) isn't group 2? What have you tried so ... (by Ganado)
Concatenate 2 lines in a vector
I have this program that cleans up some text files for me. I wanted to see if I could take any comments noted with // and move them after the line below them. ...
Jan 26, 2021 at 11:05pm
[8 replies] Last: seeplus's response worked perfectly!! (by Vendetto)
by M09
Memory limit
Code is supposed to transform all the letters in uppercase and to print the sum of the digits. Ex: in: 5 a B 6 % 7 out: AB 13 The problem is that it uses too m...
Jan 26, 2021 at 12:32pm
[5 replies] Last: Perhaps something like this which doesn't use stream insertion - but j... (by seeplus)
Why isn't my code displaying the correct output?
I am reading from a text file. Asking the user to input an inventory number and finding that inventory number using the linear search function. Then I am displa...
Jan 26, 2021 at 11:35am
[5 replies] Last: Hello lg77756, I wish I could have finished this last night, but I co... (by Handy Andy)
How to get rid "+" word in loop
How to get rid "+" on output example: i input: 6, the output is: 1 + 2 + 3 + 4 + 5 + 6 + = 21 but i want + after six is deleted #include <iostream> using na...
Jan 26, 2021 at 10:57am
[5 replies] Last: #include <iostream> using namespace std; int main() { int n {}, su... (by seeplus)
Solve my assignment please!
Make a sequence of number from 3n+1. If one of the sequence got even number then make it half from the previous sequence number. Repeat process from before unti...
Jan 26, 2021 at 10:41am
[2 replies] Last: and what part of this are you having difficulty with? Can you obtain n... (by seeplus)
structuring a game project
I'm working on a basic 2d game framework with Sdl, but I'm not sure how to make instances and game assets available to the game objects. any help would be appre...
Jan 26, 2021 at 2:17am
[8 replies] Last: I suppose singletons will work for the managers, I'll avoid globals an... (by DevReign)
How to search sentence in cpp
how to make program like this: in the cpp file there is a sentence: Dave buy 2 mangoes Felix buys 1 basketball Sara sells shoes for 200 dollars ~ when I run i...
Jan 26, 2021 at 1:51am
[5 replies] Last: sorry for late answer. thank you everyone I appreciate it. (by siabapet)
January 2021 Pages: 1234... 11
  Archived months: [dec2020] [feb2021]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.