Beginners - April 2019 (Page 19)

by poggyQ
What is fflush(stdout) doing in this strcmp example program
 
So, I was trying to understnad strcmp listed on this site. http://www.cplusplus.com/reference/cstring/strcmp/ What is the purpose for using fflush(stdout) i...
[3 replies] Last: What happens if the flush of the stdout stream didn't happen? You wo... (by jlb)
by Horror
Problems with Loops
 
...
[2 replies] Last: Duthomhas , I appreciate it! Thanks! This is my updated version of t... (by Horror)
Address of..pointer
 
Hello, If you want to access the address of a pointer, i.e. the address where the pointer is stored (and not the address the pointer stores!). Is this the co...
[4 replies] Last: yea they are correct (by Grime)
Separate String and put into Class
 
Hi :) I have an assignment to create a battleship replica via code. I'm trying to read my .csv file into my program, and I managed to remove the commas, replaci...
[2 replies] Last: Once you're changed the commas to spaces, the easiest way to parse eac... (by AbstractionAnon)
need correction in my approach
 
Shlok and Sachin are good friends. Shlok wanted to test Sachin, so he wrote down a string S with length N and one character X. He wants Sachin to find the numbe...
[2 replies] Last: > Where is the approach failing ? No idea - we can't see your code. ... (by salem c)
Can someone explain why I get the same output?
 
Is my professor's code wrong? Is my code right? //PROFESSORS CODE const int SIZE = 5; char* counts ; // Allocate arrays in dynamic memory for (int i = 0;...
[8 replies] Last: The prof's code, run through valgrind. $ valgrind ./a.out ==8410== M... (by salem c)
Symmetrical Difference
 
Hello guys! So i'm trying to write a code where it checks 2 arrays that contain integers either positive or nagative ones. After that it should return the nu...
[5 replies] Last: for(i = 0; i < n ; i++) { if(a != b ) ... (by salem c)
I am trying to have the answer come out as a decimal
 
When i compile, the answer comes out as a number with no decimal. How would I make the answer come out with two decimal points? Like currency #include <i...
[1 reply] : #include <iostream> #include <iomanip> double retail_price( doubl... (by JLBorges)
Linux c++ compile errors that baffle me ...
 
For the first time, I am trying to write a program under Linux UBUNTU using gcc and I get some compilation results on one module that I hope somebody would be a...
[7 replies] Last: @fiji885: Thanks, I changed it and the module compile without error! I... (by LeLorrain)
I have stack overflow...
 
Is this not a proper delete function for a dynamic 2d array? FloodMap::~FloodMap(){ for (int i = 0; i < rows; i++) { delete map...
[15 replies] Last: .>>GreyWolf Your solution was absolute. I forgot to change back an ea... (by jjordan33)
8-Bits of Advice for New Programmers (The stuff they don't teach you in school!)
 
8-Bits of Advice for New Programmers (The stuff they don't teach you in school!) https://www.youtube.com/watch?v=vVRCJ52g5m4
[1 reply] : Thank you for this one. By watching it I tripped over a Numberphile co... (by MikeStgt)
pi
 
Hi, I am writing a program that has to calculate pi with montecarlo method. The arrow should hit the points x and y,and they should both be globally defined th...
[11 replies] Last: Just in case someone wondered already weeks ago, today I found an erro... (by MikeStgt)
Linked List Program ->
 
I've been practising linked list for the past couple days and it's taking a while to stick in my head. I believe that I understand the concept of how it works b...
[8 replies] Last: Is [adding to the head instead of tail] the better way to create a li... (by dhayden)
Diamond Problem solving by scope Resolution Operator
 
There are two ways to solve Diamond Problem in C++, one is by using virtual and the other is by using scope resolution operator. I am facing some issues in doi...
[2 replies] Last: [quote=Enoizat]Anyway, that function doesn’t initialize ‘a’, it ... (by Grime)
Fail State creates problems......why?
 
In the program below, look at function IF.... If I enter a letter(by mistake), the cin function, go into the failed state(I guess) make the 5 loops, displays th...
[5 replies] Last: Thanks for the explanations http://www.cplusplus.com/user/Grey_Wolf/... (by geouser)
by Vetzo
Global variable - multiple instances running
 
Hello Forum, If an executable file has global variable, and you run the executable 2 times simultaneously, does each executable has its own global variable? ...
[2 replies] Last: Nice. Thank you. (by Vetzo)
Creating a simple geometric calculator that calculates the area of a triangle
 
Need help figuring out how to compile the second half of this code // Simple Geometric Calculator #include <iostream> using namespace std; in...
[4 replies] Last: SideOne would equal the triangle base length and sideTwo would equa... (by MikeStgt)
permenant headach
 
so here if something I am working on. its not done and im gonna estimate it will take me about a month to complete but its hexapon. google it. let me know if th...
[4 replies] Last: I am not totally sure how to use enum yet, but i will look into it. An... (by closed account N8MNAqkS)
I have a big problem - I have to write the function that converts a one-time list into a double search tree that is balanced.
 
My problem is that I do not fully understand how to apply the rotation functions - more precisely when I take a list item and add it to the tree I do not know h...
[1 reply] : I don't fully understand the question. but this may help you... the B... (by jonnin)
Can I give an enum member functions, as if it were a class?
 
let's say we have: enum class day { monday, tuesday, wednesday, thursday, friday, saturday, sunday, }; can we create a function da...
[7 replies] Last: you can also do foolishness :) enum days { monday = 'M', // the ch... (by jonnin)
April 2019 Pages: 1... 1718192021... 24
  Archived months: [mar2019] [may2019]

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