Beginners - November 2019 (Page 11)

Confusion in chaining
 
So what I have understood so far is that we have to make an array of head pointers which will be pointing to separate linked lists. So this is what we would cal...
[4 replies] Last: [quote=lost110]Guys! Am I doing it right? I haven't a clue what you ... (by lastchance)
MOST SIMPLEST INSERTION SORT IMPLEMENTATION!
 
Why does websites complicate insertion sort? const int size = 10; int arr = {9,8,7,6,5,4,3,2,1,0}; for(int i = 1;i < size;i++) for(int j = 0; j < i;j++) ...
[9 replies] Last: I think a good tutorial on selection sort would not use code that dema... (by JLBorges)
Circular Linked List
 
I'm trying to make a super basic circular linked list, but my program is seg-faulting when I try to enter the first number. Also, this assignment requires I onl...
[3 replies] Last: That fixed it! Thank you! :) (by stephcat5)
fstream and reading every line
 
I'm trying to get my program to read every line of my inFile but when I try using a getline() function within my while loop it would break my algorithm. What mo...
[13 replies] Last: Ok, I see what direction to take. I reseted my sum and counter after e... (by Battlefire)
Problem with minGW
 
I have a problem with minGW version and I copied archives by: hpps://github.com/meganz/mingw-std-threads , but now I have this errors: fatal error: synchapi.h: ...
[2 replies] Last: I put in prompt command and there aren't. the version are 6.3. (by victorio)
Query: Binary Tree - Preorder, inorder and postorder iterative traversals
 
Dear C++ Community I kindly want to inquire about how does replacing the stacks used with queues in preorder, inorder and postorder iterative traversal changes...
[1 reply] : Nothing magically changes just by using a different structure. What ma... (by Duthomhas)
by Quag
Functions not running properly, error: expected expression
 
My program is supposed to be an array which size is given by the user and then filled with random numbers, sorted, and find the median. I have written 3 functio...
[1 reply] : In future please use code tags and if you have compiler errors/warning... (by jlb)
by obeeey
Recursive function finding index
 
Hi :) I needed to write a recursive function returning index of the element I wanted to find, so this is it: #include <iostream> #define MYSIZE 10 int find...
[1 reply] : If you use a "standard" array, then you are going to have to signify i... (by lastchance)
Practice Code Analysis
 
Hello, it's been a while since I've been on the forum, but I have been very busy, working and enrolled in school in pursuit of my AAS in programming and develop...
[6 replies] Last: @MrCluckyToYou, No need to feel inadequate, C++11 (and now C++14/17) ... (by deleted account xyzzy)
Where to define Public: and Private:
 
Write your question here. I have a class with a header file and its associated .cpp file. The header file looks as follows: class Item //item.h { private...
[4 replies] Last: other classes only need to include a header file to make use of a clas... (by malibor)
by obeeey
Function swapping only one character in an array not whole string
 
Hi there, I'm trying to write a simple card game. My idea is as follows: I have this char 2d array containing 52 cards where every element is written with 6 ch...
[8 replies] Last: Wow, thank you all soo much for those answers! Now everything is clear... (by obeeey)
nonstandard extension 'for each' statement
 
This is for my CIS class and a method that is part of a blackjack game. The issue is that every "for each" statement is throwing an error, even though it seems...
[4 replies] Last: Thank you for the help. I know that we weren't using a console applic... (by mcnhscc39)
Weird pointer situation I don't understand
 
I'm a bit confused about the output of the following code: char* a = new char; char* b = a; *b = 'Z'; cout << *b << *a << endl; delete(a)...
[2 replies] Last: I see now! Thanks for the information! :) (by anarelle)
Is there a downside to using auto for the return type
 
I'm brushing up on my c++ and my compiler warning told me that I could use auto with c++14. Seems very convenient, but I was wondering if there might be a downs...
[2 replies] Last: > I was wondering if there might be a downside to not specificly stati... (by JLBorges)
How can I keep the result from equation in a range?
 
I want the value of dmg in this equation to be equal or greater than 0. Meaning, if the result is >0 then it gives the result only. But, if the result is <0 i.e...
[2 replies] Last: dmg= int((a-(b/6))*mp) * (int)(a>b/6); //can't jump. max hides a bran... (by jonnin)
Get String from Getline method in C++
 
Hello, I want to get a string from input but seems 'Enter' instead of an input string in num variable. #include <iostream> #include <math.h> #inc...
[4 replies] Last: Thank you but we cannot because in Hexadecimal we have for example 3C... (by dhayden)
Could this be considered a bst?
 
Hi, more studying. Is this a basic binary search tree? Thank you. #include <iostream> #include <map> #include <string> using namespace std; int main(){ ...
[11 replies] Last: >> jonnin Ohhh. That's what you meant by that. I'm with you now. I ... (by jjordan33)
Change string for dados
 
I have two errors in the functions: 'npos' was not declared in this scope; expected primary-expression before '!=' token Estado(float temperatura, DataH...
[1 reply] : std::string::npos https://en.cppreference.com/w/cpp/string/basic_st... (by deleted account xyzzy)
Char to Int in C++
 
Hello, How can I fix this code? I want to send number to a method and get Char. #include <iostream> char ConvertTo(int a) { if (a <= 9 && a >= 0) ...
[4 replies] Last: how will that work if int contains a number grater than 255 ? not att... (by lastchance)
Plot with gnuplot
 
How I can to export data in graphical format, demonstrating temperature and connection limits of resistor and fan over time with my list _temperatura:temperat...
[2 replies] Last: I usually export a CSV and let excel draw pretty pictures for me for s... (by jonnin)
November 2019 Pages: 1... 910111213... 17
  Archived months: [oct2019] [dec2019]

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