Beginners - March 2010 (Page 4)

Question regarding this prime number code.
 
Hey all, I've been reading C++ Without Fear, which in my opinion is a fantastic book for beginners. However, there's an example in the book teaching about de...
[9 replies] Last: I did and it always comes back as "number is prime." Here's the lis... (by wolfcry)
VC++ vs MinGW vs Linux GCC
 
I have written the following code and compiled it on 3 different compilers (pardon the probably terrible coding, still learning here). Each executable runs very...
[3 replies] Last: well I mean... what are you benchmarking? clock()? cout? ++a? ... (by Disch)
For Loop Issues
 
Problem: I am trying to code a sample textbook program that will take a string consisting of a first and last name that are separated by a space, (ie."John Doe...
[4 replies] Last: Zhuge, Yes, you are right. I think that it should be: for (k = ... (by jtkhoskinson)
storage area of the struct data type
 
I was trying to run this program. I am getting this error " An unhandled exception of type 'System.AccessViolationException' occurred in Project_Euler_MS_In...
[1 reply] : It looks like this: You call destroy tree, which deletes the tree and ... (by Zhuge)
template nested classes and compilation error: no match for operator!=
 
Hi everybody, I'm trying to create a matrix class. This class has a nested class called linear_t (which represents both columns and rows) and linear_t has an...
[12 replies] Last: In regard to the original problem: Here is an extract from the book "... (by guestgulkan)
Problems with templates
 
This will compile link and run: link_list.cpp: #include <iostream> #include <stdexcept> #include <Link.h> using namespace std; void keep_open() {...
[4 replies] Last: I just ran a test and you were right it is not awkward--I had a miscon... (by closed account iw0XoG1T)
how to find speed of a statement?
 
n = 5; a = n + 1; how much time will it takes? a = n++ ; how much time will this statement takes? which of the above statements is fast and why?
[5 replies] Last: thank you (by somasekharever)
Secant method
 
Please help? Not sure why it won't compile. Any suggestions? #include <iostream> #include <iomanip> #include <cmath> using namespace std; double f(...
[no replies]
priority queue
 
Can somebody please explain to me how the stl priority_queue works(not at an implementation level..more like how to use it)? And a few examples will help a lot....
[1 reply] : http://www.cplusplus.com/reference/stl/priority_queue/ (by Bazzy)
by CurtP
How do I clear cin when wrong type is entered?
 
This week I'm learning about exception handeling and I'm using try,throw,catch. When I get a char instead of an int I'm throwing that... the problem starts wh...
[3 replies] Last: Thanks I seem to have gotten it to work. I had to throw in cin.sync()... (by CurtP)
A vector( or queue) of pointers
 
Hi, If I have a vector( or a queue) I was wondering what would happen when I pop an element from it. The pointers are assigned to dynamically allocated memor...
[4 replies] Last: No. pop_back() does not return anything. It simply removes the last ... (by firedraco)
Abstract_Class
 
Hi all I'm having trouble figuring out a return for an abstract class, please see below: //Abstract Class #ifndef _ITEM_H #define _ITEM_H #include <string...
[4 replies] Last: Thank you, that's a great help :) (by alb10811)
by navi33
is this the same??
 
The problem is to print odd numbers from 1-100 and its sums. i got the problem. im just asking if it will be the same when i change something like: #include...
[3 replies] Last: you're welcome. (by Dacster13)
by navi33
how to?? last one ^_^
 
switch(choice) { case'A': case'a': cout<<"Enter value in KM: "; cin>>km; m=km*1000; cout<<km<<" KM is equal to "<<m<<" M\n"; brea...
[5 replies] Last: @firedraco: you got me there.. that answers my question~ @Grey... (by navi33)
by chron3
Error after task perform
 
I've written this as a revision and although the program works but at the end of the program, a error windows pop up. I was wondering what is wrong but i couldn...
[3 replies] Last: mcleano : it's almost like a error message when a program crashed. ... (by chron3)
Pascal's Triangle
 
Hi all, I have a question. I have created a code for printing Pascal's Triangle. There is a pointer to an array of pointer to arrays of integers. The arr...
[4 replies] Last: I have already got the desired result, the code above has been changed... (by pinoynl)
Best way to learn programming
 
Hello, for the past few years, I've really been getting into programming. I understand the basics of Visual basics, and made quite a few very inefficient game...
[8 replies] Last: Thanks everyone. I'll try to fully understand the core basics of C++ (... (by billlin)
It seems very simple, but I cant fix it!
 
#include <iostream> int main (); { int a; cout << "What is your age?" << endl; cin >> a; if (a < 11) cout << "You are " << 11 - a << " years...
[2 replies] Last: Thanks! It worked. (by Fbar800)
character replace
 
How would I replace a space " " with and underscore "_"?
[4 replies] Last: This one may be used on character arrays: http://www.cplusplus.com/re... (by moorecm)
show memory locations
 
Hi all, I have a question. How can I show a memory location in hexadecimal notation? I want to show &p in hexadecimal notation in stead of decimal. for ex...
[5 replies] Last: No problem. (by chrisname)
March 2010 Pages: 123456... 34
  Archived months: [feb2010] [apr2010]

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