Beginners - April 2022

Syntax error that I cannot find.
 
This program prints the same question after the user selects to play again and sometimes it'll print "wrong" even when the user is correct. Im assuming its just...
[4 replies] Last: vasncode, you should remove line 284 (77 in newbieg's post). It's enti... (by Ganado)
I need some explaining.
 
Hey guys. Good evening. So i've been trying to do a line of code for about a hour now but I don't seem to get it. 3 <-- how many lines 1 12.50 2 3 10.50 1 2 7...
[5 replies] Last: #include <iostream> #include <fstream> #include <algorithm> using nam... (by lastchance)
Implementing a break in my If-else statements
 
I'm trying to create a program that rolls a random number 1-6, which is then outputted to a die face, then it stops after each number has been rolled once. I fi...
[14 replies] Last: @seeplus you're correct. Those numbers I used correlate to a TDB modul... (by PopSmoke)
I cannot debug my program
 
my IDE is telling me to take out a parenthase on lines 15 and 17, if I do this my program simply wont work! please help me //Lab 9D #include <iostream> ...
[4 replies] Last: the instructions tell me to use it - can we get a full copy of the ... (by newbieg)
Translate code into pseudo code
 
Write your question here. Hello, I am done writing this code for my class and the next step is to turn it into pseudocode could someone give me an example of w...
[5 replies] Last: Slightly simplified code: #include <iostream> #include <iomanip> #i... (by seeplus)
I don't understand why this function doesn't work.
 
I am new to coding and I'm currently learning about Divide et Impera. I want to calculate the sum of the elements from an array, and I thought I should start wi...
[6 replies] Last: Ok, thank you so much!!! Now I understand!!! I gave it as an argument ... (by nandikaka)
location of known substring between 2 points in a string
 
Probably simple, but seems I'm simpler. I want to find location of known substring between 2 points in a string. I think I know how to do it in steps, but...
[7 replies] Last: The problem with std::string::substr() is that it creates a copy. Us... (by Duthomhas)
Variadic template functions
 
#include <iostream> using namespace std; void print() { cout << "I am empty function and " "I am called at last.\n"; } template <typename ...
[11 replies] Last: Thanks. void Sum(Res&) {} And although this overloaded Sum does not... (by CodeChaser)
read comport
 
Hi there, I found an example for i/o on a comport, although, I don't believe I'm getting anything on the read side of things, can anybody point me in the right...
[9 replies] Last: BTW, “comport” is a verb meaning “to be in agreement with ”: ... (by Duthomhas)
function lsqfit() that performs a least-squares fit
 
Write youThe dataset in the file “linedat.txt” contains two columns and it can be described by a linear function of the form y = ax + b. The x -value is rep...
[3 replies] Last: @jordan Combining the two previous posts with the following should giv... (by againtry)
Custom string class problems
 
Hello, for one of my college projects I am asked to create a basic string class to call upon in my code. I feel like I am very close, but something is not wor...
[14 replies] Last: Rather than having Mystring convert to const char* implicitly I think ... (by Peter87)
Caeser Cipher
 
Hey guys, I'm trying to displace letters in a sentence using a few functions but I can't figure out why I'm unable to exit the loop of getchar. Any other mist...
[2 replies] Last: char represents the type for just 1 character - not a sentence. Have ... (by seeplus)
Disadvantages of writing full code in header file and not use ".cpp" files?
 
Hi everyone, i know i'm doing it wrong but, as the title says, why can't i simply write the full code of my functions in an header files and put the header in t...
[19 replies] Last: If you have only one source file that includes something, then you ess... (by keskiverto)
Add user-input to array until user inputs 0
 
Already got down the 'keep adding to the array' until array is 'full'. But how do I get the program to stop adding into the array when the user inputs 0? Any ...
[5 replies] Last: Thanks to the both of you -- I'm learning a lot! :) I'll mark this th... (by ssspppa)
How to share program to run for a friend?
 
I just finished writing a small potion store program that just opens the terminal and prompts the user to enter information. I was curious how to share this c...
[3 replies] Last: be sure to compile it in release mode before you give it out. This he... (by jonnin)
swirly parentheses problems
 
Hello, when I try to run the code it gives me this warning main.cpp:21:5: error: a function-definition is not allowed here before ‘{’ token 21 | { ...
[2 replies] Last: Yep, It is working now, thank you for all of your help (by Codeman23)
reading params from list in string
 
Hey everyone, I have the following string: Reply from server: {"success":true,"uses":1,"purchase":{"seller_id":"PqK9YWSyICYZnR6hSnzzWA==","product...
[5 replies] Last: Yes - if the format of the reply string changes, then that extraction ... (by seeplus)
by sp7cpp
Can we pass pointer to function contains const reference variable
 
I am getting an error cannot convert argument 1 from 'Cars*' to 'const Cars&', for the following snippet.. Cant we send pointer to a function contains const ref...
[2 replies] Last: A pointer is not the same thing as a reference. The problem is not c... (by Peter87)
even if(){}code problems
 
So, I'm trying to make a code so, it asks the user what day it is, and the user says a response depending on the day (I'm very bad at code don't judge me) Code:...
[7 replies] Last: [quote=Codeman23]I'm very bad at code There is a free online tutorial... (by George P)
Can I use malloc without sizeof?
 
Hello, Could you please tell me what's the differences between these codes? and give me a clear example? Thank you int* int_ptr = (int*)malloc(5); ...
[4 replies] Last: Be aware that the size of basic types like int or long is not fi... (by kigar64551)
April 2022 Pages: 123... 7
  Archived months: [mar2022] [may2022]

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