Beginners - February 2021 (Page 11)

by ycong
'for' not recognized
 
I just started learning c++ on VS code and when I tried to run a for loop, the program said that the 'for' command was not recognized. I'm sure that the code it...
[4 replies] Last: your guess is as good as mine! I actually do have a couple of the thi... (by jonnin)
operator overloading
 
I am trying but unsuccessful to write an algorithm which will replace the erase function from string library, calling the method in the main function alike obje...
[3 replies] Last: dhayden, thanks a lot for your explanation, all your suggestions were ... (by MaxGreen)
Finding the minimum value of a line in a 3D array
 
Hello everyone, I need a small help. I have a 3D array like X . Each cell of this array holds a value. I need the b indice which corresponds to the minimum ...
[8 replies] Last: Thank you so much @keskiverto. However, I need the middle indice of th... (by learner999)
Passing Filestream functions ifstream or ofstream
 
Hello, there. I am trying to open a txt file. There are many text files that I will be opening in the code that is why I am trying to create a function where yo...
[5 replies] Last: If you pass ifstream by ref in a function, then you can do things like... (by seeplus)
Days between dates.
 
So I've been struggling with this homework for a long time... This still does not work and teachers comment was that I have to change the code and add set,get o...
[5 replies] Last: CountLeapYears() should count the leap years in this date. So it shoul... (by dhayden)
A moving assignment exists with a friend function in the class and error occurs.
 
When I declare a moving assignment and a friend function in the class, an error occurs at "return temp" on compilation. I donot know why. Any reply would be a...
[2 replies] Last: @seeplus Thanks. I got it now. When the moving assignment is defined, ... (by wanabeahacker)
const reference
 
I trying to udnerstand const reference. In the code below does it mean that what is being returned by get() is not the copy of x (a copy of x like in pass by va...
[7 replies] Last: My bad. I read 9C0 as 920. My eyesight! You replied before I had the c... (by seeplus)
Reading file.txt with mixture of first name, last name & middle name
 
I have a file below. Some have a name as input, there were a few with middle name. How should i store the names? For the first line i can use a dummy line to ...
[2 replies] Last: Consider: #include <fstream> #include <iostream> #include <sstream>... (by seeplus)
Tried a for & while loop...what am I doing wrong?
 
Excuse me, for I'm very new to c++. This is my first language I'm learning. Self taught with a udemy course, and web searches. I'm trying something on my own ...
[13 replies] Last: When I was taught programming more years ago than I care to remember b... (by seeplus)
by mnm71
how can convert ?
 
I want to convert float array1 to const float * array2, How can I?
[2 replies] Last: If you just want to pass it to a function that accepts const float *, ... (by dutch)
Counting total number of arithmetic operations in nested loop
 
Hello! So here is a question. I have to count the number of arithmetic operations when given an array to sort A(4,2,5,3,1). SO N=5 So I am just trying to figur...
[6 replies] Last: Yes, the test will run one more time than the increment, but if n is 5... (by dutch)
Win32 message
 
Hello, I am coding in 64 bit in Visual Studio 2019 C++ nevertheless looking to the output appears "(Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'" among...
[4 replies] Last: Now I understood! Thank so much Ganado and JLBorges, very precious inf... (by DanielDeChamps)
C++ class
 
Program only lets user to insert start date, output is completely wrong... #include <iostream> #include <cmath> using namespace std; class Dat...
[2 replies] Last: I havn't thoroughly tested this but from the troubleshooting i've done... (by markyrocks)
function value won't apply to loop
 
I am trying to create a game and I have come across a problem I've been trying to fix for a few days now. Just an FYI, I put if(shotgun == 'A'), and realized I ...
[5 replies] Last: I only ask bc shotgun has a direct effect on the value of shotgunhelpe... (by markyrocks)
operator overloading
 
Good day pals, Really need your help, reference and opinion about the next task. Without using the string library functions, I have to write a method using th...
[4 replies] Last: @seeplus, thanks a lot!! (by MaxGreen)
Printing an array of string with the help of struct
 
Hello. I am trying to print the two strings but it seemed to have an error. I am new in learning structures which is why I am having difficulty in testing. Any ...
[2 replies] Last: @Ganado ohhh I see thanks. You are a huge help man. I still have a lot... (by WeebTriestoCode)
function returns the ordered array index
 
Hello everyone, can anyone tell me is there a special function which returns the index of sorted array in c++. basically, I have an array like V=[-8.0 ,-1.0, ...
[4 replies] Last: Thank you @lastchance (by learner999)
String Array Is Populated But String Is Empty?
 
My code is found at https://repl.it/@AndreLouis/caesarsCipher#main.cpp My problem is on line 76, or the return value of caesarsCipher, encrypted_message. Whe...
[2 replies] Last: Hi Salem. Thank you for going to the trouble to copy my code and fix ... (by AndreLouis)
C++ writing
 
Sorry for my question, i cancel ask
[1 reply] : [Note this is C++/cli] (by seeplus)
Problem with while loop
 
Why doesnt it print 9 8 7 6 5 4 3 2 1 0 -1 #include <iostream> int main() { int num = 10; while (num >= 0) { --num; std::cout << num << std::end...
[3 replies] Last: v1 does v2 doesn't because --num is after cout. The while loop is onl... (by seeplus)
February 2021 Pages: 1... 9101112
  Archived months: [jan2021] [mar2021]

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