49,760 Topics

Member Avatar for
Member Avatar for phorce

Hello could someone explain what I'm doing wrong to get the error: Segmentation fault: 11 when trying to fill in a 2D array from two for loops? Here is the code: Matrix.h [code] #ifndef _Matrix_h #define _Matrix_h using namespace std; class Matrix { public: Matrix(); // Constructor Matrix(int M, int …

Member Avatar for phorce
0
1K
Member Avatar for XO39

Please be easy on me and don't shoot me as I'm still newbie. I'm totally confused and can't for life figure out why when I run this code: [CODE]y = 9; cout << "++y = " << ++y << "\n--y = " << --y << "\ny++ = " << y++ …

Member Avatar for XO39
0
177
Member Avatar for MrEARTHSHAcKER

Hi, Has anyone any clue why message boxes keep showing 2-3 times after clicking one of their button in Borland? Please answer, I need help. Thanks!

Member Avatar for MrEARTHSHAcKER
0
87
Member Avatar for myrongainz

btw this is a part of a battleship code i want to know what the integers a,b,c,d,e,f... do I know this has something to do with placing ships randomly but it is a little complexed for me. I'd appreciate it if someone took their time to explain it [CODE]int placeship( …

Member Avatar for zeroliken
0
199
Member Avatar for mitrious

I have a node class that has a pointer to Node indicating its parent Node [CODE] class Node { . . . Node *parentNode; }; [/CODE] I receive a pointer to node in the constructor being the parent Node of the current node being created or a NULL value if …

Member Avatar for deceptikon
0
5K
Member Avatar for king03

any ideas how to solve this?: I am using Visual Studio 2008 for compiling c++ programs and when I press f5(which is at default, the start debugging button) the console window flashes for a bit and then closes, but when I click on start without debugging, the console window stays …

Member Avatar for BobS0327
0
137
Member Avatar for Zssffssz

Earlier when I came here I had only a minimal set of utilities and a WinXP comp.. Now i'm here and serious, with kubuntu (and Internet!!!!) and willing to learn all of that dd, mov, eax, and bochs stuff. Here is my delemia: I have a C++ Program, have no …

Member Avatar for Zssffssz
0
343
Member Avatar for Zssffssz

I have been given a task to send a file (.odt) via e-mail using no external libraries (stuff that doesn't come with GCC on ubuntu) and not using .NET. Compiler: GCC/G++ (with limited access to ACK) OS: Kubuntu 11.10 32 Bit IDE (like it matters): Code::Blocks Help Point Me in …

0
60
Member Avatar for DezineGenerator

Here is code which i am using Please check it first [CODE] for(x=0; x<=y; x++){ if(a=x||b=x||c=x){ printf("Value =%d",x); } } [/CODE] In this code x is a base for the loop i want loop till y (variable). Now inside the loop i want to check a condition if x (variable) …

Member Avatar for DezineGenerator
0
428
Member Avatar for Suzie999

Hi I have a function I use in a win32 dll which downloads the source of a web page to file. The primary windows function used in it is "URLDownloadToFile" in "urlmon.h" But I would like to have a function that downloads directly to a string or char array. I …

Member Avatar for thines01
0
148
Member Avatar for rfrapp

I'm writing a program that adds two hexadecimal numbers of up to ten digits. I'm trying to use the POW function, but for some reason it's underlined. Why is that? [CODE] // hex addition.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <string> …

Member Avatar for LRRR
0
583
Member Avatar for VernonDozier

Here's the code. Uncomment line 9 and you get the following error. [quote] ISO C++ forbids initialization in array new[/quote] Leave it commented out and it works just fine. I'm not sure why it has a problem with one but not the other. Each object is a 16 byte array. …

0
117
Member Avatar for phorce

Hello, I'm trying to create a matrix that dynamically defines the rows and columns.. Now, everything is fine, apart from when I include a function to output the 2D array.. The error: Matrix.cpp:20: error: invalid types ‘double[int]’ for array subscript ... The code is: Matrix.cpp [code] #include <iostream> #include "Matrix.h" …

Member Avatar for phorce
0
126
Member Avatar for RavesCoder

Hello Daniweb users, i wanted to ask you guys , if you can help me with making a game with C++, Do you know how to do it? or any suggestions? I prefer RPG Game... So if you have any suggestions, could you help me? Thanks, Jordan

Member Avatar for jaskij
0
170
Member Avatar for aashishsatya

Hi, I'm an absolute beginner in Visual C++ (Express Edition 2010). I've just been trying out this very simple program, and I can't get to use the '\b' tag like I did when I used Turbo C++ v4.5. The cursor moves backwards, but the text does not get erased, as …

Member Avatar for LRRR
0
305
Member Avatar for daryll1

Hi, I'm having a major problem with passing GCC link flags in Xcode. I created a C program that creates and runs a neural network using the FANN library. When I compile this command line I use the command [CODE]gcc main.c -o train_test -l fann[/CODE] to link the fann library …

0
101
Member Avatar for mikeshadow

I need an algorithm that finds how many prime numbers are in a set interval; the interval maximum range is 1 000 000 so a brute force method of checking every number is kinda inefficient

Member Avatar for mikeshadow
0
501
Member Avatar for prabh94

what is FPE? how do i correct this in my program....tried everything...:sad: [code]#include<iostream> using namespace std; int factorial(int a) {int f=1; for(int i=1;i<a+1;i++) { f*=i; } return f; } int main() { int factorial(int); int n;cin>>n;int x=n/2,y=n%2,d,e,f,sum=0; for(int i=0;i<n;i++) { d=factorial(x+y);f=factorial(y); if(x==0) { e=1; } else { e=factorial(x); } if(y==0) …

Member Avatar for jaskij
0
449
Member Avatar for myrongainz

btw this is a part of a battleship code i want to know what the integers a,b,c,d,e,f... do I know this has something to do with placing ships randomly but it is a little complexed for me. I'd appreciate it if someone took their time to explain it [CODE]int placeship( …

Member Avatar for WaltP
0
364
Member Avatar for Despairy

i have made a (not soooo good ) game using vs2008 i have a controller class which holds a level loader class once i quit the game i do [CODE]delete Controller // from the main file[/CODE] which goes to the controller destructor : [CODE]Controller::~Controller(){ delete screen; delete loader; delete eventer; …

0
65
Member Avatar for emokidzz

[CODE]#include <iostream> #include <windows.h> #include <conio.h> using namespace std; int selectHero(); void Str(); void Agi(); void Int(); void Kunkka(); int Item1(); int Item2(); int ChooseI(); void NormalAtk(); void AInormalAtk(); void Choice(); void Attack(); void Skill(); void Defend(); int Run(); void AIchoice(); void AIattack(); void AIskill(); void AIdefend(); int AIrun(); void …

Member Avatar for samuelgray
0
400
Member Avatar for pseudorandom21

Here is a sort of description to my yet-unimplemented AI agent to play tic-tac-toe. It doesn't have to win, it just has to work, and my description of it has to be good. Tell me what you think: [code] /* "RATION_AL" The goal of my agent is to implement an …

0
143
Member Avatar for fastali

[CODE]char *ReadFile(string& filepath) { string buffer=""; char temp_char; ifstream file; file.open(filepath); while(!(file.eof())) { file.get(temp_char); buffer+=temp_char; } size=buffer.length(); char *result1=new char[size]; for(int i=0;i<buffer.length();i++) { result1[i]=buffer[i]; } file.close(); return result1; }[/CODE] code looks pretty normal right? but when I run it with the rest of the program this happens... [url]http://imageshack.us/photo/my-images/267/chararray0001.jpg/[/url] [url]http://imageshack.us/photo/my-images/28/chararray0002.jpg/[/url] [url]http://imageshack.us/photo/my-images/11/chararray0003.jpg/[/url] …

Member Avatar for fastali
0
143
Member Avatar for a.muqeet khan

guys i have a little problem in my file handling program that is i cant get the whole file to be saved just the end portion i want to know why this happens and how to counter it [CODE]// file handling flag testing and practise.cpp : Defines the entry point …

Member Avatar for thines01
-1
379
Member Avatar for jaskij

The program is supposed to compute the values of [URL="http://mathworld.wolfram.com/GammaFunction.html"]Euler's Gamma Function[/URL] using an infinite product (formula #15 in the link), and it does so decently for low values, but the error gets too big for bigger values. Using both Mathematica and Maxima for reference this is what I get …

Member Avatar for jaskij
0
206
Member Avatar for DarthPJB

Ola' daniweb, long time no see. I've been absent for a while, mostly due to not having any problems to ask about, but also because I got one of those annoying 'job' things ^_^. Anyhow, I'm not terribly familiar with C# (being from c++ land), however I've got to use …

Member Avatar for thines01
0
800
Member Avatar for Down2Skills

Hey everyone, I've made basic Apps before and I'm a beginner to C++ i need help with functions on a calculator [url]http://i40.tinypic.com/f2r0i0.png[/url] This is my current GUI for it, it has no functions yet, could anyone please tell me if i click on the buttons that it would show on …

Member Avatar for Down2Skills
0
87
Member Avatar for phorce

Hello, I'm creating a Matrix, that the user can manually define the rows and columns.. (This will be defined in a class) But, I'm having trouble resizing the vector to what is set in main.. Here is the code: Matrix.h [code] #ifndef _Matrix_h #define _Matrix_h #include <vector> using namespace std; …

Member Avatar for VernonDozier
0
2K
Member Avatar for stereomatching

I need to make the last 5 bits of the unsigned int become zero(1111_1111 to 1110_0000) There are two solution [code] unsigned int number = 0xFFFF; unsigned int temp_one = number & (~0x1F); unsigned int temp_two = number >> 5 << 5; [/code] which one is faster? I write a …

Member Avatar for mrnutty
0
118
Member Avatar for LacyMacy

[CODE]//So I'm writing this program that converts change into smaller denominations. //For example .97 would be 3 quarters, 2 dimes, 0 nickels, with 2 remaining. //The program compiles and runs but it's not the completely correct output. Can //anyone help. //Converts change into small denominations. #include "stdafx.h" #include<iostream> #include<conio.h> using …

Member Avatar for Lerner
0
205

The End.