49,761 Topics

Member Avatar for
Member Avatar for anthonys1mom

Hi there. I am trying to create a class rectangle. It should have data members length and width of type float (which should default to 1). The class should have member functions that calc. area() and perimeter() and also separate get() and set() functions for length and width. These should …

Member Avatar for Lerner
0
17K
Member Avatar for tech9x

[code=c++]while(!infile2.eof()) { size_t found; string temp2, store, wordtobold; string command1 ("bold"); size_t prev_pos = 0, pos = 0; getline(infile2, temp2); store += temp2; found=store.find(command1); if (found!=string::npos) wordtobold = store.substr (found+4); while( (pos = wordtobold.find(' ', pos)) != string::npos ) { string wordtotag( wordtobold.substr(prev_pos, pos-prev_pos) ); cout << wordtotag; prev_pos = …

Member Avatar for WaltP
0
116
Member Avatar for volc90

Hi i was wondering if someone could tell if i am anywhere close to being on the right track. I have to create a program which adds, subtracts, multiplies, and divides fractions. I really am trying to get a grip on learning this stuff, so anyone who could give some …

Member Avatar for Lerner
0
130
Member Avatar for IMJS

I wonder if anyone can point out the source of my error. I am using the SDK for commercial software which _requires_ that I build etc in Visual Studio 2008. I confess that my C++ is rusty at best and that I don't understand a lot about using Visual Studio. …

Member Avatar for IMJS
0
324
Member Avatar for Feim

Hi all, I have this string "May 19, 2009 15:39:41.606809000" , i need to get the seconds into a double variable. My code is like this: [CODE]double sec; string seconds = str.substr(19,10); istringstream(seconds) >> sec; [/CODE] The thing is that seconds = 41.6068090 , but sec = 41.6068 Why doesn't …

Member Avatar for Feim
0
130
Member Avatar for zoefschildpad

so I'm writing a binary search tree and a (so far very short) program taht uses it. Here's the code as it is (excluding any functions it doesn't actually use yet) main.cc: [CODE=c++]#include <ctime> #include <cstdlib> #include <iostream> #include "bintree.h" using namespace std; int main(){ double aipls[500]; bst<int> k; int …

Member Avatar for SasseMan
0
2K
Member Avatar for Violet_82

Hi there, I have a question about header files/source files in Visual C++ (I use visual c++ 2005 express). I used to put all my code in one single .cpp file but now I have a test program (done by my tutor at Uni) which has 3 files: 2 .cpp …

Member Avatar for Violet_82
0
427
Member Avatar for modesto916

Hi everybody, I bought the book "Deitel C++ How to Program, edition 5", and i am doing the exercises of the chapter 4, the exercise 4.28 ask you to write a program that print the following figure: [ICODE]* * * * * * * * * * * * * …

Member Avatar for alwaysLearning0
0
255
Member Avatar for CPT

So I've implemented the binary search tree but i get an error from the insertion function this is my code: [CODE]#include<iostream> #include<stdlib.h> #include<malloc.h> using namespace std; struct NOD{ int inf; struct NOD *left; struct NOD *right; }; NOD *root; bool Erase(int nr); void Insertion(int nr); int Search(NOD* node,int target); void …

Member Avatar for Taywin
0
162
Member Avatar for Finarfin34

I am developing an application using Win32 GetOpenFileName win32 API. When the window opened even if I click cancel memory usage incredibly increases from 2 mb to 8 mb. What could be the reason of this behaviour? Thanks in advance.

Member Avatar for Ancient Dragon
0
240
Member Avatar for tehreem

hey frnz i need 2 make a c++ project ...but i dunno wat 2 make im so confused help me out..i need a guidline

Member Avatar for stokes1900
0
144
Member Avatar for Isimanica

This code has errors [CODE]#include <iostream> void main() { int var [10]; for (I=0; I<5; I++) cout << var(i); }[/CODE] Now what I have come up with is this to correct the errors that I see. [CODE]#include <iostream> using namespace std; void main() { int var [10]; for (i=0; i<5; …

Member Avatar for stokes1900
0
94
Member Avatar for smart

Hi, Friends Here is a site which has video lecturses on C and C++ which are downloadable [URL="http://freevideolectures.com/computerscience"][B][COLOR=blue]http://freevideolectures.com/computerscience[/COLOR][/B][/URL]

Member Avatar for sylviaj
0
519
Member Avatar for timb89

im trying to output my bfs in this manner, showing the connections rather than the individual nodes: input 0 1 1 0 1 0 0 0 1 0 0 1 0 0 1 0 output (0,1) (0,2) (2,3) rather than: 0 1 2 3 this is my code so far, …

Member Avatar for alwaysLearning0
0
169
Member Avatar for Jennifer84

Hi, I wonder how it would be possible to programatically take a screen shot (Print screen) Then second, I do wonder how I now can save this screen shot to a .BMP or .JPG file? I would be happy to learn how this is possible to do. Thank you!

0
50
Member Avatar for prashanth s j

Hi all, I have a double pointer in C as follows: [code] void foo(char * , char**); main( ) { char * inbuff = {0x10,0x20}; char * outbuff; foo(inbuff, (char **) &outbuff); } void foo(char *inbuff, char ** outbuff); { //code to manipulate inbuff and outbuff. *outbuff = (char *) …

Member Avatar for hussnain abass
0
345
Member Avatar for chrishtones

So I am trying to set up Lua on Visual C++ 2008 and I keep getting this error: [B]error C3861: 'luaL_newstate': identifier not found[/B] Here is an example of my code: [CODE] #include <iostream> extern "C" { #include "lua.h" } using namespace std; int main(int argc, char* argv[]) { lua_State …

Member Avatar for 3ing
0
85
Member Avatar for donmiq

So basically, I have this: [CODE=C] bool getDouble ( double & value, const string & prompt); int main() { char userSelection; do { cin >> userSelection; if (userSelection == '1') { double radius; if (getDouble (radius, "Please enter a value: ")) { cout << "good"; } else { cout << …

Member Avatar for donmiq
0
70
Member Avatar for HBK_100

Why is this not reading from the file The contents of the file [CODE] 123456 James.Watson 234567 12.Clover.Crescent Spanish.Town St.Catherine Single Standard Passprot [/CODE] [CODE] ifstream file; file.open( "guest.txt", ios::in ); if ( !file ) { cerr << "File could not be opened" << endl; exit( 1 ); } guest …

Member Avatar for thelamb
0
88
Member Avatar for bob200707

Hello, I am currently working on a program that is supposed to do the following: I am supposed to take a data file of 5 student names that are in the following form: lastName firstName middleName. I am supposed to convert each name to the following form: firstName middleName lastName. …

Member Avatar for jonsca
0
376
Member Avatar for tKc

I need help in calculating the variance for randomly generated values (using srand(seed)). When i input 5 i should get 97359589.15265 but i am getting 1.29888e+010. I am almost positive i went wrong in the calculation of the variance but have no idea what to do in making it correct. …

Member Avatar for jonsca
0
155
Member Avatar for losh177

Hi, I'm working on an overloding operator homework. I'm overloading the + = += << [] && operators to work with objects that contain int arrays that can be set to have index from x to y instead of 0 to x. I'm getting the LNK2010 & LNK1120 errors on …

Member Avatar for losh177
0
240
Member Avatar for Nathaniel10

An exercise is to write a program that shows how memory is allocated to stack variables compared to heap variables. I ran the following code. [code] #include "../../std_lib_facilities.h" int main () { char c = ' '; char ch0[10]; char *ch = new char[10]; char *init_ch = ch; cout << …

Member Avatar for Nathaniel10
0
155
Member Avatar for javarook

Im just trying to read a file to see if i did the code correctly but I keep getting this error. Any help is appreciated. [CODE]#include<stdio.h> #include<stdlib.h> #include<string.h> struct Node { char name[15]; char title[15]; int year; struct Node *next; struct Node *prev; }; typedef struct Node* Box; Box build_node(FILE …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for coolboym99

So I'm writing a sorting program for my class where we're required to sort three files by Insertion Sort, Shell Sort, and Quick Sort. By the way that it works, I ended up using vectors for all the data, and I've got Everything working now, except for the shell sort. …

0
66
Member Avatar for tech9x

[code=c++] while( getline( infile2, temp2 ) ) { size_t prev_pos = 0, pos = 0; while( (pos = temp2.find(' ', pos)) != std::string::npos ) { string wordtobold( temp2.substr(prev_pos, pos-prev_pos) ); cout << wordtobold << '\n'; prev_pos = ++pos; } string wordtobold(temp2.substr(prev_pos, pos-prev_pos) ); // Last word cout << wordtobold << …

Member Avatar for tech9x
0
2K
Member Avatar for daviddoria

If I use a template function with T where T = itk::Image<unsigned char>::Pointer, everything is fine: [code] #include <itkImage.h> class Test { public: template <class T> void Add(T patch); }; template <class T> void Test::Add(T patch) { } int main(int, char*[]) { Test a; itk::Image<unsigned char>::Pointer image; a.Add(image); return EXIT_SUCCESS; …

Member Avatar for daviddoria
0
3K
Member Avatar for WildBamaBoy

Just started learning C++ today. I'm writing a program to keep up with school assignments. [CODE] #include <iostream> #include <stdlib.h> #include <fstream> #include <string> struct Assignment { string Period; string Title; string Page; string Date; string Instruct; }; void NewAssignment() { system("CLS"); Assignment Work; cout << "New Assignment Entry" << …

Member Avatar for WaltP
0
351
Member Avatar for Bri426

I'm having so much trouble with this assignment, and I was wondering if anyone would be able to help me out. Here is the assignment: This program uses the file "cities.txt", which contains over 136,000 location names in the United States. Each line of the file contains a place name …

Member Avatar for SasseMan
0
380
Member Avatar for rahul_galgali

Plz help, I have declared three stuct struct student { CString Struct_Name; CString Struct_RollNo; }; struct Division_struct { CString strDivName; CArray <student, student>arrStud ; }; struct Class_struct { CString strClassName; CArray <Division_struct, Division_struct > arrDiv ; }; ///to access class struct CArray <Class_struct,Class_struct> arrClass ; My question is how to …

Member Avatar for daviddoria
0
94

The End.