49,761 Topics
| |
i have written a class to add matrices ,line 51 of the code has problem. debugger is showing segmentation fault there . please suggest the correction. [CODE] #include <iostream> using namespace std; class mat { int row; int column; double **a; public: mat(){} mat(int r,int c) { row = r; … | |
I need to read data from a file into an array of structs. The info is arranged in the file like so... Spear of Extreme Whaling January 1851 Captain Ahab Each member of the array has a name, month, year, and first and last name of creator. This is the … | |
Hi guys, Im pretty dam stuck at the moment on an assignment Im meant to do. Its my last question so everything is pretty laid out, but the question (to me is not useful) so if you could just help me out it'd be much appreciated Ok so what i … | |
Hey, I'm not too sure what the problem is here, I have never had trouble using fscanf before. The following shows the code I use to check the file, and the result. [CODE]while( true ) { int vals_read = fscanf(fileHandle,"%[^;];%s",&name,&pass); if( vals_read == 2 ) { // process the line … | |
I want to make a simple text program based on the game minesweeper that asks for the number of columns and rows, and asks for the number of mines then create the gameboard with the number of mines scattered throughout on standard output. Any help? | |
I've been trying to code an array where its size is dynamically allocated. It's been a while since I've coded and so I was wondering if you guys could give me some help? There's also a randomize function that allocates the array with a random set of numbers (the quantity … | |
Im a fairly fresh programmer, and I often run into problems like most of us. Most of the time I get it solved in 10 minutes by some google power, but this time Im stuck for real (spent the last 4 hours looking around the web). I first ran into … | |
Hi, I am trying to understand functions in my C++ class and i was wondering what would be an algorithm to evaluate function and find its maximum and minimum. If someone could explain this to me i would greatly appreciate. | |
Problem: Write a program that uses a loop to display the characters for each ASCII code 32 through 127. Display 16 characters on each line with one space between characters. I have tried solving this problem several ways. I either get blank screen or numbers 1-16. Can anyone lend a … | |
Just when I think I understand this stuff some else crops up to bite me. This part was supposed to be the easy part of the overall project so this does not bode well... What am trying to do is create an array of 32 variables that will be filled … | |
I realize this is a pretty simple operation, however im totally lost, and no post I could find seem to touch on the exact same subject as mine. I have a text file, where each line is formatted like so: [CODE]float1,float2,float3,float4,float5,float6[/CODE] Each float is separated by a comma. The number … | |
This is my first time to use the string function. And I met some errors while doing the practice. We now need to input some words, until we input a word with 4 letters. Then the program will show the smallest and the biggest word among our inputs. e.g. Enter … | |
I am using the free alternative to SPY ++ known as Winspector, and was suggested to start using this to get more familiar with windows and handles and process handles etc... My question here is I notice when I put the crosshair over certain windows I get WINDOWS and a … | |
Is there a way to create a C++ program to rewrite a query in an optimal form without the use of a database such as storing information in arrays. If so, how? What can I do to implement this. Rewrite SELECT EMPOYEE.EMPNO, POSITION FROM EMPLOYEE E, JOBHISTORY J WHERE E.EMPNO … | |
I am building a dll file. when i try to compile the dll file i get the following errors... help me am new to vc++... tool used is visual studio 6.0 GPPSCOM.OBJ : error LNK2001: unresolved external symbol "double __cdecl RoundDown(double,int)" (?RoundDown@@YANNH@Z) GPPSCOM.OBJ : error LNK2001: unresolved external symbol "double … | |
How can I check that the user actually is inputting what I want them to? (For example letters or numbers); I need the user to input y or n, so here is how i tried to solve it: [CODE] char answer; do { system("cls"); cout <<"Want to play? <y/n>: "; … | |
[code] class complex { int real; int imag; public: complex(){}//why default constructor is always needed complex(int a,int b){real = a;imag = b;}// why can't we define only this constructor ~complex(){} }; [/code] | |
This is the full code and the single error!!!!! 1>d:\s\o.o\hws\new folder\shop\shop\main.cpp(37): fatal error C1075: end of file found before the left brace '{' at 'd:\s\o.o\hws\new folder\shop\shop\shop.h(8)' was matched [code] #include<iostream> #include<string> using namespace std; #ifndef SHOP_H #define SHOP_H class Shop{ friend ostream &operator<<(ostream &output,const Shop &S){ output<<"\nThe name of the … | |
i make twwo single linkedlist,, but i didn't know how i can merge those lists ;; [ICODE]#include <iostream.h> class linklist { private: struct node { int data; node *link; } *p; public: linklist(); void append( int num ); void appendd(int size); void display(); }; linklist::linklist() { p=NULL; } void linklist::append(int … | |
I have an assignment where I need to Sort the linked list according to Int Variable after the user has input the information. When I try using bubble sort I'm stuck because I don't know how go back to the beginning. If a user enters : 5 4 3 2 … | |
I'm trying to make the quicksort but it's not working at all. I made a helper function "swap" so I can call it back in the "quick"function. then used recursive method to do it till the array is sorted. The problem is.. IT'S CRASHING EVERYTIME I RUN IT... i think … | |
Hey guys, so I just started learning computational geometry, and I decided to make a class for a Point and a class for a Ray. This is my code: [CODE]#include <iostream> #include <string> using namespace std; class Point { public: double x, y; Point(double x, double y) { this->x = … | |
I am making a program which includes comaring 2 numbers (int's) but later I want to call another windows function and it takes in CHAR not int. I need a way to convert my ints to char. I looked up this on internet and non if it worked. Do you … | |
Any tutorials on how to use CFile or any other, to open a text file, get what's inside into memory, e.x Link List, and then put it back into text file when done? Please link me or guide me through this problem. Trying to get a Payroll system going. | |
Hey guys I have the following class code and i get an error in the addVertex method that says vertexList is not declared in scope but i dont know why. [CODE] #include <iostream> #include "DirectGraph.h" #include <string> #include <list> #include <vector> DirectGraph::DirectGraph(): vertexList(100) { } void DirectGraph::printShortestPath(int source) { } … | |
Here's a simple, though not the most efficient, program that flags and displays all prime numbers less than or equal to 1000. | |
Hi I am currently primarily programing graphics applications and am still fairly new to this. I know the relevance and can see the advantages of making items a template especially with things such as collision detection. I was wandering is there any advantage/disadvantage to doing everything as a template? Obviously … | |
Hi everyone.I have a strange problem.I've written a class which handles registry keys and values of which there are two functions [code] template<> unsigned long RegistryEntry::GetValue <unsigned long> (std::string Name) { unsigned long Value; unsigned long DataSize; assert (RegQueryValueEx (Key,Name.c_str(),0,NULL,(unsigned char*)&Value, &DataSize)==ERROR_SUCCESS); return Value; } template <> char* RegistryEntry::GetValue <char*> … | |
I'm trying to save everything to a .txt file with a new line after every string, but I can't get it to work for me. I tried using [ICODE]<<endl;[/ICODE] and [ICODE]"\n"[/ICODE] but it all gets written in a single line. So if I enter "John" for [ICODE]first[/ICODE], "Smith" for [ICODE]last[/ICODE], … |
The End.