51,592 Topics

Member Avatar for
Member Avatar for Clockowl

Hi guys, I tried rewriting my C-ish C++ function to true C++, but I'm failing so far: The first function (working) [code=cpp]const visualPart * entity::getVisualPart(unsigned int wantLOD){ for(unsigned int i = 0; i < visualEntity.size(); i++){ if(visualEntity[i]->LOD == wantLOD){ return visualEntity[i]; } } return NULL; }[/code] And the second (not …

Member Avatar for Clockowl
0
99
Member Avatar for anshulagarwal

when i m using this code: its not complete code..assume everything is right... [code] for(int result=0;result<g;result++) { u1+=((a[result].real_z1*tw[result])/sumd); u2+=((a[result].imaginary_z1*tw[result])/sumd); u3+=((a[result].real_z2*tw[result])/sumd); u4+=((a[result].imaginary_z2*tw[result])/sumd); } cout<<"\n""Value of U1:"<<setiosflags(ios::scientific)<<setw(10)<<setprecision(8)<<u1; cout<<"\n""Value of U2: "<<setiosflags(ios::scientific)<<setw(10)<<setprecision(8)<<u2; cout<<"\n""Value of U3: "<<setiosflags(ios::scientific)<<setw(10)<<setprecision(8)<<u3; cout<<"\n""Value of U4: "<<setiosflags(ios::scientific)<<setw(10)<<setprecision(8)<<u4; ofstream abc; abc.open("result.txt", ios::out | ios::ate); abc<<endl<<endl; abc<<"Data at position [ "<<i<<" , …

Member Avatar for ArkM
0
427
Member Avatar for krebstar

Hi guys, its me again.. I was wondering if anyone could tell me how to test a character if it is within the ASCII range, like say in the following pseudocode: [CODE] ifstream in; in.open("file.xxx", ios::binary); if(!in) { cerr << "file.xxx could not be opened. \n"; } while (!in.eof()) { …

Member Avatar for krebstar
0
6K
Member Avatar for comondx

Please help me doing my homework. this homework done with C++ Data Structure. This is Questions: [URL="http://img520.imageshack.us/img520/4417/qqqq1gvq5.gif"]http://img520.imageshack.us/img520/4417/qqqq1gvq5.gif[/URL] [code]#include <iostream> #include <stdio> #include <assert> #include <string> #include "bt.h" class Calc { public: } ; int main() { bSearchTreeType<Calc> obj; string command; cout<<"I-Inputtheexpression"<<endl; cout<<"N-InorderTraversal"<<endl; cout<<"P-PreorderTraversal"<<endl; cout<<"O-PostorderTraversal"<<endl; cout<<"F-Numberofoperatorinthetree"<<endl; cout<<"E-Evaluatethetree"<<endl; cout<<"Q-Quit"<<endl; cin>>command; do { …

Member Avatar for Manutebecker
0
93
Member Avatar for davidleeis14

C++ reading text files I have a program which I am writing which manages a savings club. I have set up a functions which creates members (there are two members types) and outputs there data to a text file a line at a time in the format string, int, int, …

Member Avatar for Agni
0
4K
Member Avatar for vvim

Hi Group, for a project[1] I am trying to find an OS independant way to measure the amount of cpu usage and memory consumption of the program. It would be nice if I could do that in my C++ code, so I can show the results at runtime or even …

Member Avatar for William Hemsworth
2
285
Member Avatar for waldchr

Hi I have a program i was writing to solidify my knowledge of files and how to handle them. I seem to have hit a snag though. What the program does is create files based on a user inputted date and allows them to add content to the files (kind …

Member Avatar for waldchr
0
120
Member Avatar for gispe

Hi ppl, I've written a simple program with strings. this just recives the name and last name of a person, and then print it. i had a few problems with this: at first, it didnt let me define a variable as "string", it gave this error: [code=cplusplus] C2679: binary '>>': …

Member Avatar for CoolGamer48
0
335
Member Avatar for neverness

Hello people, Alright, my problem is something like this. I've declared a nested struct within a class template, and i want one of the member functions of the class to return an object of type struct. Somehow, i seem to be unable to do this defining the member function outside …

Member Avatar for neverness
0
254
Member Avatar for anshulagarwal

hello freinds.I am anshul agarwal doing my summer internship in Germany. I am facing one problem in visual c++.. Actually i have done a project in borland c++ but because of memory constrain, I am forced to switch over to visual c++... My program is to read 5000 data from …

Member Avatar for VernonDozier
0
245
Member Avatar for krebstar

Hi guys, I'm having a little problem setting a string value to another string.. I have the class: [CODE] class FILENAME { public: string GetFullPath() const; void SetFullPath(string& fname); private: string fullpath; }; [/CODE] The declaration for the SetFullPath Method is: [CODE] void FILENAME::SetFullPath(string& fname) { fullpath = fname; } …

Member Avatar for krebstar
0
192
Member Avatar for brizhou

what code can i use so that if the coodinates of a mouse represented by symbol @ goes over coodinates of apples representedby symbols & and makes the & disappear on the grid? im thinking which would be more effiecient, the if or switch statement

Member Avatar for CoolGamer48
0
84
Member Avatar for chanda gul

Hi...can any1 help me in this code?? i am trying to read the content present at address 0x2c of memory of floppy...but i am having problem in this...please tell me how can i do this??? [code=cplusplus] #include "stdafx.h" #include "fat_32.h" #include <conio.h> #include <memory.h> #include <string.h> #ifdef _DEBUG #define new …

Member Avatar for Salem
0
129
Member Avatar for AlanZinober

This refers to instantiation and "uninstantiation". I need to solve an ode system many times with a varying paramter p in an iterative loop. It seems that I cannot use "out" and "ode" repetitively in the code below. The code works when N=1. Is there a way of "uninstantiating" and …

Member Avatar for AlanZinober
0
151
Member Avatar for conan19870619

i had a thought to write a program to play boggle. i already know how it works and decide to use a heap-based method. However, i just dont know how to write a basic step: look up a word in a dictionary. So,if i have a word "program", how can …

Member Avatar for Duoas
0
743
Member Avatar for cernette

Hello, I've got a simple program intended to read in one column of float data from a .txt file (with a variable number of lines) into a dynamically allocated array. The array contents should then be written to the screen, to test if this was successful. However, the code output …

Member Avatar for ArkM
0
109
Member Avatar for JaR

Hello! I tried searching for this error, but it seems a little uncommon, so I decided to register here. My problem is, that i would like to declare an iterator of type [ICODE]std::list<std::vector<T> >::iterator[/ICODE] within a for statement. I tried it like this: [CODE=C++]template <class T> class CSplit { private: …

Member Avatar for JaR
0
116
Member Avatar for murdercityriot

I'm having some problems getting some code (which I believe is compliant to the Microsoft C++ definition) to compile on CodeWarrior (which uses is ISO definition). I've sorted some of the syntax errors out but I'm stumped by this one: [code] inline T* GetNext(const T* a_elem) const { return (T*) …

Member Avatar for murdercityriot
0
98
Member Avatar for JaksLax

Here is the code I have [ICODE] #include<iostream> using namespace std; void push_t(int j) //--------------------------------------------------- // Accepts a value and pushes it onto the stack top // Precondition: if keyset = 0 the deque does not yet exits // deque is a structure with int j for data // Postcondition: …

Member Avatar for Salem
0
86
Member Avatar for 2fac323

I am writing a program that lists a breakfast menu with prices and lets the user make an order. I am stuck on a few points and need some advice to get the program to run correctly. The first problem, I can only get amount due to calculate the tax. …

Member Avatar for 2fac323
0
105
Member Avatar for jack1234

In java we can use System.out.println In C# we can use Debug.Println but how to do it in C++? (The syntax, and where to look for the debug message)

Member Avatar for bugmenot
0
3K
Member Avatar for mehtaneha84

My question might be very basic but I really do not know how to do this... I need to create a structure, something that looks like a protocol (a data packet actually)...this packet consists of 3 parts header, data and trailer... The header has 3 offset bytes, 64 bytes of …

Member Avatar for mehtaneha84
0
476
Member Avatar for ninjaneer

Hello again, daniweb. I have created a managed C++ GUI using windows forms that needs to call some functions in an unmanaged C++ DLL that was created by the MATLAB compiler. The functions from the MATLAB compiler need to be run in their own thread in the background while input …

0
80
Member Avatar for CPPRULZ

I know this is probably a very stupid question, but I can't make the user input a string.I thought I could use cin...here is my code: [code=C++] #include<iostream> //#include<cstdlib> //#include<cstdio> #include<cstring> using namespace std; int main() { int x=0; string thing[10]; cin>>thing; //x=atoi(thing.c_str()); //cout<<x; system("pause"); return 0; } [/code] I …

Member Avatar for CPPRULZ
0
181
Member Avatar for kwesicat

Hi Every One, I am working on an assignment that needs to be submitted on 08-08-2008. The IDE in use is Dev-C++ 4.9.9.2. Basically, everything works well untill the program calls for values which are not avalable for a given energy 'energy[0]'. It will run but at these points it …

Member Avatar for kwesicat
0
115
Member Avatar for coveredinflies

Hi, just came across character escape sequences e.g '\a' The "alert" character, ` `\b' Backspace, `\f' Formfeed, `\n' Newline, `\r' Carriage return, `\t' Horizontal tab, `\v' Vertical tab, ` I can only get some of them (new line and horizontal tab) to work. Do you have to do something special, …

Member Avatar for Duoas
0
119
Member Avatar for sahmedsa

I always see solutions to some questions regarding classes, and they have (*this) , I don't understand when to use it and how to use it. Does it just mean that we're referring to something? Please help me out. (an explaination with an example would be helpful) Thanks

Member Avatar for Duoas
0
71
Member Avatar for Nemoticchigga

I am trying to run a simple program to read ethernet using UDP. Here is the code, but it always receives -1 for 'error', but I did it by the book. Do you guys see the problem? Thanks. [CODE]//enum specifying the current status of the comm port. enum e_PortStatus { …

Member Avatar for Salem
0
120
Member Avatar for arun_lisieux

Guys, Im not very experienced in C++. I was practicing problems from topcoder to improve my knowledge in C++. I've posted the code i used for solving a problem statement given by topcoder website. The compiler tells that there is a linking error with this code and hence its not …

Member Avatar for ArkM
0
252
Member Avatar for Corum

The circular list code is incomplete program with lots of feature missing, it's only one specific section that I require help with but I thought it would better to show the entirety of it to help you understand better. The section surrounded by -------------------------- is where I'm stuck, basically the …

Member Avatar for Corum
0
133
Member Avatar for besktrap

So, I'm making a simple program that can edit text files. I have a text input that says "Please enter the name of the file, followed by a '.txt'. ". Although, whenever I enter a name, it will only show you the first character of what you entered. So, how …

Member Avatar for VernonDozier
0
101
Member Avatar for Sana nawaz

Instructions Please read the following instructions (related project code) carefully: You'll be expected to observe good programming standards. • Project code must follow C++ syntax • Data used in each project must be retrieve and saved in Text Files • Your project may cover the concepts learnt in CS201 particularly …

Member Avatar for VernonDozier
0
149
Member Avatar for tootypegs

Hi, i think i have a pretty random question here and something i thought i would be able to do but unfortunately im struggling. I have an example I have found on the msdn website. It works fine however i want to move all the code so that it just …

Member Avatar for mitrmkar
0
108
Member Avatar for richM
Member Avatar for richM
0
47
Member Avatar for FTProtocol

I haven't posted in a while as i've been getting better and better at solving problems myself but im starting a new project. Basically what it does: - Runs continuously in the background - Done - When IE or Firefox is opened it begins the main loop - Needing process …

Member Avatar for William Hemsworth
0
131
Member Avatar for NickyU

I start a new thread about this. I need just a piece of code that reads a bmp file. I [B]NEED[/B] this. Every program i made used custom graphic files, and a very unpractical graphic editor made by me . It would be more comfortable to use paint to make …

Member Avatar for NickyU
0
114
Member Avatar for NickyU

i use an older compiler, borland c++ 3.1 and it doesn't have the bool variable type so i made my own bool type [code] enum bool { false = 0, true }; [/code] but always when i try to make comparisons or other thing i get the warning ASSIGNING INT …

Member Avatar for NickyU
0
249
Member Avatar for usedcars

I am web designer. I have skills in html, css and editing some javascript. I want to start studying programming specially for web development. Unfortunately, i do not have a basic background on programming. Can you please help me what is the basic or easiest programming language should i start …

Member Avatar for ArkM
0
105
Member Avatar for delsigno

Ive been programming in java for about a year and im starting to learn c++ and i tryed public Unit Human = new Human(); that just came up with a bunch of errors in c++ so i read some tutorials and changed it to Unit* Human = new Unit(); now …

Member Avatar for delsigno
0
105
Member Avatar for crioto

For example, i need my own compress format (like zlib). I need to standard archivers this Compress file does not open! What should I do? Can I do this with the help of zlib? Or slightly altering zlib? Or will have to write your compressor and decompressor? I hope I …

Member Avatar for Duoas
0
91
Member Avatar for hellooo

[QUOTE]#include<stdio.h> #include<stdlib.h> #define MAX 30 int menu(){ int choice; printf("1. Add a new reservation\n"); printf("2. Show details of a reservation (given reservation number)\n"); printf("3. Make Payment (given the reservation number and payment amount)\n"); printf("4. Confirm a Reservation (given the reservation number)\n"); printf("5. Quit\n"); printf("Enter your choice: "); scanf("%d", &choice); return(choice); …

Member Avatar for Agni
0
138
Member Avatar for Abakiz

My problem is that when i enter a second name into t it just ignores it or crashs the system, am running borland 5.5. When i enter Oli its fine but when i enter Oli Dl it crashs. [code=cpp] #include<iostream.h> #include<iomanip.h> void main() { char t[100] = {0}; char key …

Member Avatar for WaltP
0
85
Member Avatar for nikki123

hello, can anyone help me for the following C++ program. i want to write a program which reads a file of C language and Print Lines of Codes and print signature of all function (including main) in that file. please tell me either logic to develop this program or solution(code) …

Member Avatar for vmanes
0
146
Member Avatar for zourlas

It might sound stupid to most of you.....but it is the first time i want to write 2 columns of data in a txt file.....The first column will be an index of the second column. The second column has constant length but the index will have length from 1 to …

Member Avatar for zourlas
0
151
Member Avatar for Ccrobinson001

I have a program due shortly and I can't get this to work. I have many errors that show up and can't figure them out. Can I get some help to get me on the correct path. [code=c++] // This program shows a structure with two nested structure members. #include …

Member Avatar for Ccrobinson001
0
4K
Member Avatar for Anonymusius

I have this code: [code] #include <iostream> using namespace std; class hello { private: char array[4][5]; public: hello(); void get_hello(){cout << "From the function: array[2][2] = " << array[2][2] << endl;} } hi; hello::hello() { char array[4][5] = { " ###", "####", "####", "####" }; cout << "From the constructor: …

Member Avatar for killdude69
0
164
Member Avatar for Traicey

I have struct which is like this [ICODE]struct Node { int Num; Node *Point }[/ICODE] so the program has to insert the numbers in the list during the execution, so the user can insert as many number as s/he wants so I want to sort those numbers when printing, I …

Member Avatar for Prabakar
0
103
Member Avatar for &rea

hello, I have get through this problem, I want to divide these numbers but the result calculated by c++ is not right. I am quite sure it is due to the type of the variables but I don't know how to solve it. [code] unsigned long long u40=16825420246; unsigned long …

Member Avatar for &rea
0
128
Member Avatar for williamnz

Hi there, I have one class (MyClassA), with a method draw() from this method I am trying to access an instance of MyClassB. The instance has a variable v[X] and v[Y] which I need to access but can't because it is declared as private... Is this possible via pointers? Could …

Member Avatar for William Hemsworth
0
395
Member Avatar for Daco

hi everyone, a friend of mine made a program that was bounded on your mac. a few days ago he released his code and i was interested so i downloaded it. i took the mac retrieving code and placed it in my own code. once all .h and everything were …

Member Avatar for sachin1_pangare
0
527

The End.