Beginners - February 2022 (Page 7)

returning 32767 instead of -1 in Binary Search
 
Need help reviewing the recursive code. The iterative version works, but with the recursive version, it returns 32767 instead of -1 when "6" cannot be found. ...
[11 replies] Last: include <iostream> int binarySearch(const int* arr, size_t low, siz... (by seeplus)
Getline prints extra line from text file
 
Hi, im new to C++ and im very confused as to why does the getline prints the extra content after I split the string with a delimiter also is there a better way ...
[3 replies] Last: #include <iostream> #include <string> #include <fstream> int main()... (by seeplus)
Print first and last element of a vector
 
Read a set of integers into a vector. Print the sum of each pair of adjacent elements. Change your program so that it prints the sum of the first and last ele...
[2 replies] Last: Possibly using iterators: #include <iostream> #include <vector> #in... (by seeplus)
having problems with Time-Sfml
 
I'm trying sfml but I just can't seem to get the hang of TIME, for some reason this function here doesn't work as I would expect it to? #include <sfml...
[1 reply] : it just prints out the limit? even when the timefr is greater than t... (by lastchance)
Help With Headers
 
Can I ask why in C++ you put the function prototypes / declarations in a .h / .hpp header file, with the functions in a .cpp implementation file? As a novice...
[13 replies] Last: Use the C++ library headers and there is no extra compile time, the C+... (by deleted account xyzzy)
How can I parse a char pointer string and put specific parts of it in a hash map in C++?
 
Lets say I have a char pointer like this: const char* myS = "John 25 Los Angeles"; I want to parse this string and put it in a hashmap, so I can retri...
[1 reply] : with what you have, its pretty much myMap["John"] = myS; //you should ... (by jonnin)
Pointer
 
what the difference ? how can we read this two lines. iPoint = &number; *iPoint = 40;
[2 replies] Last: L2 iPoint is set to the memory address of the variable number. In this... (by seeplus)
February 2022 Pages: 1... 567
  Archived months: [jan2022] [mar2022]

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