General C++ Programming - March 2010 (Page 2)

loading a graph from txt file
 
I have finished implementing my graph and the adjacency matrix. Now I have to save it to an txt file and also load it. I am thinking of saving it in form of adj...
[1 reply] : So, what? Have you looked at file streams? (by closed account S6k9GNh0)
Can anyone spot a problem with this code?
 
#include<iostream> using namespace std; class DumbBell { int weight; public: int setWeight(int); }; int DumbBell :: setWeight(int w...
[11 replies] Last: what line is the error? as far as i can see from the error, it is t... (by chimera)
Problem with writing to a file
 
Hi. This is my first post in this awesome forum. I have problem with these codes: #include<iostream> #include<fstream> using namespace std; class Book...
[11 replies] Last: The insertion and extraction operators ( << and >> ) both have built-i... (by jRaskell)
i have a problem with that coding
 
...
[4 replies] Last: Thanx a lot for the code... so if i wanted to add this chars how co... (by badiparmagi)
Make string of variable/member/class name
 
Is there a way to make a string of a class member name? Let's say I have a class named MyClass with a member named mMember. mMember can be any type of object. ...
[1 reply] : I don't know about _hook, _ref and CI_GET. Maybe that's some stuff to ... (by imi)
std::ostrstream is not buffering data properly
 
I am using following piece of trouble code on my project. I have few problems with this.. code is: { std::ostrstream m_testBuffer; m_testBuff...
[5 replies] Last: oups. I did read stringstream, and not strstream. :-) Yep. That's w... (by imi)
How to catch error : The memory could not be read.
 
Hi all, I am experiencing this error: The instruction at '' referenced memory at ''. The memory could not be read. What I want to do is possibly Catch that e...
[6 replies] Last: Yea.. VARIANT is not part of the standard lib. I got the feeling, ... (by imi)
copying char array contents into char pointer array
 
hello every one am new to this forum.. and i need urgent help regarding how to copy contents of char data to char* items its urgent .. thanks regards ...
[2 replies] Last: thank you very much.. i'll try this.. (by yakubpasha)
How numbers are rounded
 
How are floats rounded to integers in C++? Does it only round up, or does it work like this: 1.1 = 1 1.4 = 1 1.9 = 2
[5 replies] Last: double round(double num) { return (num > 0.0) ? floor(num + ... (by closed account z05DSL3A)
by JHO
I am becomming confused
 
I have two programs that I am having trouble makeing here are the steps 1. write a program that declares two constants (A and B) (This is where I get lost) 2...
[3 replies] Last: int A=1;//declare and initialize variable A with constant int 1 fl... (by Dacster13)
Web browser data
 
I was wondering how I would go about taking an integer from an html table in any popular browser and use it in the program. I dont have any code to show for it ...
[6 replies] Last: Thank you very much. I will try it when I get the chance. (by omen4669)
Do while & for loops have to be executed at least once?
 
I have a question: Will the statement block of a while loop be executed at least once? Also, same question for a for loop. I think the answer is no for b...
[3 replies] Last: you just pointed the difference between a do-while and a while loop. ... (by maikel)
C++ copy constructor trouble =(
 
I'm having trouble getting my code to work properly. I have two classes: Vertex, which represents a vertex in 3-space, and Matrix, which is a 2d array of ve...
[7 replies] Last: vector frees its own memory, and since you didn't allocate anything fo... (by imi)
TI-84 and C++
 
I have made a couple programs to help me out in math in C++, and I was just wondering if I could convert or transfer them onto my TI-84 calculator? any help is ...
[4 replies] Last: Z80asm is the only way to program TI processors. As an avid fan of the... (by tummychow)
by badny
fread
 
Hi there! I´m triyng to copy the header of a BMP file into a defined struct inside my code. This header has this format: int (6 var) 1st-->6th struct me...
[14 replies] Last: That header sucks. With it, you dont get any information about the bm... (by imi)
Anyone to fix this??
 
//example of constructor #include <iostream> #include <string> #include "simple.h" class Simple{ string Mystring("This is what am testing"); publi...
[14 replies] Last: In that code there is a declaration for a no argument constructor for ... (by closed account 1yR4jE8b)
g++ Code Size
 
Today, I noticed that a simple HelloWorld program compiled with GCC 4.4.1 compiles to about an 850kB executable. I'm doing some work using MPI, and I noticed...
[11 replies] Last: Sorry, that's my bad, I'll be the first that'll admit that I CAN be a ... (by closed account 1yR4jE8b)
Modifying a Program with Functions
 
I need a little assistance with a program I need to modify. Here is the original code. #include <iostream> using namespace std; int main() { double sa...
[1 reply] : It looks like you have some functions that you need to define. These a... (by sammy34)
Validating Password
 
This is a homework assignment that I'm trying to get a little direction on. The assignment states that I'm to accept a password from a user that is a minimum o...
[3 replies] Last: Thank you MorningStar that was a tight piece of coding. Even better I... (by Hopeless Programmer)
Ping , How should it be done ?
 
Hi all! I need to make a program which pings a target and gets timeout value for each request.This program will be used on Windows computers. I guess there're...
[4 replies] Last: Thanks for answers, IcmpSendEcho Function seems quite useful. (by Dufresne)
March 2010 Pages: 1234... 23
  Archived months: [feb2010] [apr2010]

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