49,766 Topics

Member Avatar for
Member Avatar for need_Direction

Hi there, I have a problem in breaking a sentence into each string. i have tried to use find() to search for the " "(space), use substr to search from the first string index into the find space number. It works for the first string. But I am unable to …

Member Avatar for need_Direction
0
120
Member Avatar for rugae

I've know that a pointer to some dynamic memory must be deleted to prevent memory leaks. Now if say a struct/array or some other data structure, each with its own dynamic memory parts. If that structure (class, file...etc) contains the data structure goes out of scope does that automatically free …

Member Avatar for Narue
0
127
Member Avatar for RohitSahni

I am calling one c++ exe from my unix shell script, i am trying to set the env variables using putenv() thru my c++ code. Now i want to use these varibles in my new exe which is there in the same shell script(set by using the previous exe ) …

Member Avatar for Ancient Dragon
0
128
Member Avatar for addicted

Hey, I just want to start using mfc to create windows objects, i have never tried coding using the mfc and opening the tutorial page on microsoft's msdn is the slowest thing that can happen around here. so i will like someone to quickly give me a hint on how …

Member Avatar for Ancient Dragon
0
103
Member Avatar for eranga262154

Hi all, The topic is my question. I’ll explain it more. Just look at the following C++ code segment, [CODE=cplusplus] if(number_1 == number_2); { std::cout << number_1 << " == " << number_2 << std::endl; } [/CODE] Note that, I have put a semicolon just after the right parentheses. It’s …

Member Avatar for eranga262154
0
1K
Member Avatar for joshmo

hey..would anyone help me with my code. the program is supposed to get telephone starting and ending times from a file from the user then outputs the total duration and calculates the cost. my program does all this but it is giving me a problem in finding the total cost …

Member Avatar for joshmo
0
81
Member Avatar for Duki

Hey everyone, I'm still tweaking the attributes but here is what I've got: [B]All races:[/B] dmg = rand, where 0 < r < str [B]Human[/B] 25% chance of blocking 5% chance of double attack (attack x2) 10% chance of dmg+60 [B]Elf[/B] 5% chance of blocking 35% chance of double attack …

Member Avatar for Mouche
0
179
Member Avatar for eranga262154

Hi all, I want to use a dynamic buffer in one of my application. I'll explain it in this way. Depend on one of my calculation I found a number(int value), and I want to define a buffer size to that value. Then after doing all the required process need …

Member Avatar for eranga262154
0
87
Member Avatar for mrmonkee

I have an exercise like this: Design a simple text editor in console mode, not window form max character in a line is 80 user can move cursor up, down, to left and right, insert, delete character I don't know how to build it :( i should use linked list …

Member Avatar for jbennet
0
2K
Member Avatar for nicz888
Member Avatar for rajgopal.uoh

Can anyone help me in developing a code to draw triangles with given the lengths of the three sides.

Member Avatar for WaltP
0
39
Member Avatar for eranga262154

Hi all, I want to find the end of file in a CFile. What I've do up to now is, find the length of the file in bytes. Then do the required process with the number of bytes. Here is the code, [CODE=C++] int length = 0 ; CString str …

Member Avatar for eranga262154
0
562
Member Avatar for clski1973

I have trouble approaching my program assignments. First I write out an algorithm. and work out each part if the program. Then I get nervous. and overwhelmed. with the errors in compliling and such. I have been working on the current assignment several days. And am frustrated and 2nd guessing …

Member Avatar for Duoas
0
307
Member Avatar for coolbreeze

I am just preparing to take a quiz and he said some examples will be kind of like this and I was just tryin to get some input on if these answers I have are the right ones.. he said just do what the statement says, no further work, just …

Member Avatar for WaltP
0
89
Member Avatar for chanah

I don't know if this is the place to ask:confused: , but anyhow: My problem is this: I need to find the absolute minimum and maximum of a function of two variables, in a given bounded area. There are several numerical methods for finding local extrimum of functions, but none …

Member Avatar for Salem
0
87
Member Avatar for jacknight

I searched the forums but I didn't find any useful information. I am just trying to write a simple recursive solution to do F(n). It seems simple to me but I am probably not thinking about it correctly. My program has no errors, but it only returns 55 and then …

Member Avatar for jacknight
0
84
Member Avatar for n.aggel

Hi, if we had the following program:: [CODE=c++]int main() { int a, d; int b=12; int c=13; a=b+c; d=b+c; return 0; }[/CODE] what would gcc produce as a result? would it be:: [CODE]fetch b fetch c add store to a fetch b fetch c add store to b[/CODE] Or something …

Member Avatar for n.aggel
0
160
Member Avatar for Jobe007

Good day fellow Buds. I was working on a nother C++ program and suddenly the program did not want to compile. It gave me this error message: Compiler: Default compiler Building Makefile: "C:\Documents and Settings\Jan&Gretel\My Documents\Makefile.win" Executing make... make.exe -f "C:\Documents and Settings\Jan&Gretel\My Documents\Makefile.win" all g++.exe -c main.cpp -o main.o …

Member Avatar for Salem
0
51
Member Avatar for gehad3003

hi can any one help with Mersenne Prime numbers calculator. A prime number is defined as being a Mersenne Prime if it is of the form 2^n – 1, where n is any integer greater than 1 display all the Mersenne primes from 2 through 1,000,000. Your results should be …

Member Avatar for gehad3003
0
799
Member Avatar for nicz888

#include <iostream> using namespace std; void getMonthName(int monthNum); void main() { int month, i=0; cout << "Enter a month " << endl; cin >> month; while (!cin.good() && i <3) { cout << " Bad input.\n"; cin.clear(); cin.ignore(80,'\n'); cout << " Try again: "; cin >> month; i++; } while …

Member Avatar for vijayan121
0
94
Member Avatar for curt22

Hello everyone I'm having trouble writing part of a vector to a file. I'm getting this error: [QUOTE]main.cpp:287: error: cannot convert `std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to `const char*' for argument `2' to `int fprintf(FILE*, const char*, ...)'[/QUOTE] This is part of my code: [CODE]ListViewTextItem.begin(); FILE * pFile; pFile = fopen …

Member Avatar for Salem
0
93
Member Avatar for handsome_94

[CODE]void hexad(int i) { int j=0; int x=0; int chii=0; while(x<8) { second2[x]=' '; second1[x]=' '; x++; } switch(codesum) { case 744 : while(i<12 && temp[i]!='\0') { second2[j]=temp[i]; i++; j++; } strcpy(second1,"CE "); break; case 410 : while(i<12 && temp[i]!='\0') { second2[j]=temp[i]; i++; j++; } chii=second2[0]; switch(chii) { 'A' : …

Member Avatar for handsome_94
0
125
Member Avatar for pacman326@gmail

Hey guys, I am trying to take chars from a file, and place them into 2 different dynamically allocated arrays. An example of the file would be name:John Doe&id:1448&phone:98765 One array stores name, id, and phone, and another should store each value. I have gone ahead and taken the string …

Member Avatar for pacman326@gmail
0
242
Member Avatar for rugae

Is it safe to compare strings with == operator or is .compare recommended? One of my teachers said NOT to use the == operator and always use a function when available. The example given was somthing along the lines of "when cpu is under high usage the == operator behaviour …

Member Avatar for vijayan121
0
206
Member Avatar for rogenie

Why does the code below stop executing after displaying all the numbers stored in an array? [CODE]//this will let the user enter 10 values and //store them into an array. After that //sort it out and cout the largest and the smallest number entered #include <iostream> using namespace std; int …

Member Avatar for rogenie
0
123
Member Avatar for sandhyamanheri

Am not able to display the polynomial. Thr some problem in display function. Please help me out in this. [code=cpp] #include "stdafx.h" #include <iostream> using namespace std; // Creating a NODE Structure struct node { int coe,exp; // data struct node *next; // link to next node and previous node …

Member Avatar for Duoas
0
127
Member Avatar for phalaris_trip

I think I've been up too long at this stage.. I think this is a really stupid question: How do I declare all my objects from main() ? I have an object 'sun' of the class 'CPlanet' and within that class there is an instance of the class 'CAnimation'. But …

Member Avatar for phalaris_trip
0
119
Member Avatar for Massena

Hello! I'm new to the the forum and to programming in general, so after learning how to make variables, if statements and loops (badly) I decided I was tired of so much learning and had to make some sort of program or game :) . Tic-Tac-Toe jumped to mind and …

Member Avatar for Massena
0
83
Member Avatar for meiyantao

I am sorry for that I have solved it, just missing a ";" when I define the class. I have re-edited this thread. So sorry for flippancy!

Member Avatar for meiyantao
0
224
Member Avatar for kpillsb39

Hi, I have built a program for Dijkstra's algorithm, but not sure why it does not display the shortest path thru the matrix. Would someone please point me in the right direction to get the code to work. Thanks, code follows, no errors, but no display of path vertices for …

0
87

The End.