Beginners - November 2014 (Page 41)

Help me understand the code
 
Hey could anyone help me understand how the for loop works? My problem is that I don't understand the (pnPtr <<szName + nArraySize) part, I think that pnPtr = ...
[2 replies] Last: Yeah, thx! after reading your comment and searching around a little bi... (by gingging)
how to keep track of points without using an array?
 
i started doing a program that my professor assigned and realized that i can't use arrays because i dont know how many points there are going to be in the file ...
[5 replies] Last: Looks like there are a few issues in line 45 - double check your sourc... (by PCrumley48)
how to use while(inFile.good()) to keep track of points and sums
 
i have to create a program that finds the best fit line from a file the user enters that contains the points but we dont know how many points there are so i had...
[1 reply] : '.' symbol is decimal separator. 2.2 is read as single floating poin... (by MiiNiPaa)
Random number generator
 
hello everybody. I encountered that I do have a Problem with programming in c++, when I try to define classes and work with them. I have a Java background, a...
[10 replies] Last: Ah, my bad. use this: static std::mt19937 gen(std::random_device{}())... (by MiiNiPaa)
const char pointer
 
When i use this code and print out cout << *szString; it only prints the first letter but when i print cout << szString; the whole word prints i thought cha...
[3 replies] Last: Overloaded functions are a number of functions (or operators) with the... (by Peter87)
by drax
vector
 
How can I get new vector from matching elements of in this example vector and array? Thanks! for (vector<string>::iterator i = ingredients.begin(); ...
[3 replies] Last: I apologize for not making myself clear, but you assumed right, thank ... (by drax)
write in the cin as much numbers as i want
 
i know it might be a silly question but i totally forgot the code so im doing a program that calculates the class average, i remember a code that keeps the use...
[no replies]
by wuubb
is there a better way to write this function?
 
G'day mates! I have been working on a "games" program in C++ that includes several games including a rock, paper, scissors. I have a header file, where I hav...
[2 replies] Last: Thanks mate, I really appreciate it! I'll definitely "look up" what a... (by wuubb)
by rayna
I need help with output manipulation.
 
So I have to write a code that lets the user input an integer called size and i have to display a a square so that the length and width are determined by size. ...
[4 replies] Last: Try this. #include <iostream> using std::cout; using std::cin; usin... (by HatchetMan302)
by wiswis
convert string to double
 
Hi guys. I have been looking everywhere for an answer and couldn't find one. I am a beginner in c++ and I have an assignment. The assignment asks to read a set ...
[1 reply] : ifstream infile; infile.open("C++ Data File.txt"); double ... (by anup30)
String reverse
 
Hi, Below is my code to reverse a string. But when I am printing the reverse of a string it is coming out to be empty. Can somebody please help me? ...
[2 replies] Last: got it.. thanks.. (by rahul135)
Left sided Diamond
 
I am trying to create the diamond (with 5 rows) using for loops. I think I have the idea correct but it's not outputting the diamond right. The diamond should l...
[12 replies] Last: yep (by JoJodoggy1)
Help in looping files...
 
Hey all, Yes, this is part of a HW assignment but I broke it down into parts. Im trying to loop a file and display the first number. Whats driving me crazy i...
[4 replies] Last: A loop ends when a condition is met that makes it false. For example,... (by disturbedfuel15)
by sbas10
Starting Out With C++(7.5)
 
I've been reading the "Starting Out With C++" book and I have a question. Here is the paragraph: "The Range-Based for Loop versus the Regular for Loop...
[8 replies] Last: you are right MinniPaa. i meant It will not work, is wrong term. su... (by anup30)
by goldyn
Reverse array
 
How can I get my array to output it's reverse with what I've already created? I'm confused. #include <iostream> #include <stdlib.h> using namespace std...
[7 replies] Last: @giblit you are right, now i see it haha. For some reason i just assum... (by Jacobhaha)
by cyter
Invalid pointer error thrown on freeing pointers of pointer array.
 
So I'm trying to deallocate memory allocated before but I keep getting an invalid pointer error whenever I run my code. - here's the code http://rextester.com/...
[1 reply] : You are trying to free pointers to character literals, which is illega... (by MiiNiPaa)
Memory Leak with linked lists
 
I have a function called del() that deletes all the nodes in a linked list. If I declare a String called a and call a.del(); in main and leave my destructor emp...
[2 replies] Last: I actually just figured it out. I think I was calling _CrtDumpMemoryLe... (by gibnihtmus)
by brenP
Calculation Error in findLowest() and findHighest()
 
For this program I was looking to input five scores - take the lowest and highest scores and drop them Take the remaining scores and avg them I have written ...
[1 reply] : Hmm. What if there were 9 judges instead of 5? The code would start ... (by dhayden)
NIM GAME
 
I began taking C++, most of the assignments that I had been given so far were easy for me except this one. This program is a NIM game, but the user plays agains...
[2 replies] Last: I might have it figured it out, though the problem I'm having is with ... (by CuteComputerXx)
virtual class help.
 
Hi guys, got a prob. In my main i want to call the perimeter int rectangle class rectangle but there seems to be a problem with my object. Can i get some help. ...
[3 replies] Last: In class polygon: I suspect that perimeter and area should be abstra... (by dhayden)
November 2014 Pages: 1... 3940414243... 65
  Archived months: [oct2014] [dec2014]

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