51,593 Topics

Member Avatar for
Member Avatar for unikiller

I've been working on this class for about 2-3 weeks and I got everything done except the reducing part. I can't figure it out , I know you have to use the GCD algorithm , but I cannot figure out how to use it :o , Can someone please tell …

Member Avatar for siddhant3s
-1
111
Member Avatar for AnthIste

Hello there. I am very new to C++ and still rather new to programming (Im only in high-school). I am trying to make a decision based game that runs in a cli to just get going with the language syntax somewhat. So far the game is working, and I made …

Member Avatar for Sturm
0
169
Member Avatar for prushik

Ok, I'm trying to write a little game in c++ using very simple graphics. not opengl or anything like that. Everything compiles fine (There are some warnings, i know how to fix them im just lazy, ill do it later) all of my code worked perfectly until i added the …

Member Avatar for iamthwee
0
102
Member Avatar for veronicak5678

Hello- I need to do a selection sort on two different 2d arrays, sorting by the last column of one of them (thirdarray). The first column of thirdarray is the effective column size for the first (morearray) array. I am so confused. I cant find any examples to help me. …

Member Avatar for veronicak5678
0
110
Member Avatar for helixkod

This is the current assignment: Write a program that determines which of 5 geographic regions within a major city (north, south, east, west, and central) had the fewest reported automobile accidents last year. It should have the following two functions, which are called by [I]main[/I] [I]int getNumAccidents()[/I] is passed the …

Member Avatar for Lerner
0
281
Member Avatar for teppuus

Hello, I am trying to call two functions: one that pulls data from a file and stores into a linked list, and one that displays this data to the screen. I pulled my code out of the functions and created a new file and included everything in the main function, …

Member Avatar for teppuus
0
162
Member Avatar for pri_skit

I have written a CString Object into Text file by using : f.Write (&FileName,FileName.GetLength());//FileName is CString Object Now I want to Read CString object back How this could be done?I am using code : LPTSTR p = CurrentLanguageName.GetBuffer(11); void *g=(void *)p; f.Read (g,CurrentLanguageFileLen); CurrentLanguageName.ReleaseBuffer( ); //But this method don't work. …

Member Avatar for pri_skit
0
122
Member Avatar for phylon

I am trying to read matrix data from file into a float vector the file has data like X = {1.0, 2.0, 3.0...........} Y = {3.4, 3.1, 3.4...........} I can read into vector strings. But I want to store the matrix names in a string vector and the matrix in …

Member Avatar for Ancient Dragon
0
186
Member Avatar for Max_Payne

I made this Data Table. The problem is when the outputs are different it will change the shape of the Table. I need some tips on how can i fix this problem. [code=cpp] [INDENT]double sum = 0; for ( int j = 0 ; j < 5 ; j++ ) …

Member Avatar for ithelp
0
124
Member Avatar for rogenie

why does this file outputs 516?? The value of numbers is being read from random.txt that has 200 random numbers in it. I was expecting this to output 200 and NOT 516.. whats up with this? [CODE] while (inputFile >> number) { //number of numbers on the file for (totalNumber …

Member Avatar for rogenie
0
162
Member Avatar for lucamarcus

Am a new c++ programmer. I refer to the code " Bouncing Ball" which is a GUI, now there is a rectangle created, i managed to change the color the rectangle in the main window and what my may problem is how to make the rectangle fixed and not only …

0
98
Member Avatar for greglobal

Does anyone have a solution/c++ code to make bmp images transparent on the fly without having to carry out 2 bitblt operations with the image and it's mask ? We want to develop a game in which there are many moving objects which have to be rendered transparent at new …

Member Avatar for JRM
0
100
Member Avatar for pri_skit

I am drawing a screen which requires refrehing,so Invalidate() function is called continously.Now I want to start a timer when screen is drawn first time.In the timer i want to call another function which draws another screen after some time.How this could be done? I have tried to start timer …

Member Avatar for pri_skit
0
53
Member Avatar for JesseQ

/cry i am having troubles with my c++ program i was asked to [quote] You will modify your program to allow the user to enter their move as strings of “paper”, “rock”, and “scissors”. Modify how the computer’s move is stored such that it is also a string of either …

Member Avatar for Salem
0
315
Member Avatar for Koldsoul

I am having issues getting this function to work. This is a currency conversion program that gives the user choices of input of three other currencies other than USD and converts it. It is supposed to be a value returning function, not a void function. The program compiles, runs fine, …

Member Avatar for Koldsoul
0
214
Member Avatar for helixkod

this is my current code: [code] #include <iostream> using namespace std; void celsius(double); //Main int main() { cout << "Now displaying the first 20 fahrenheit temperatures and\n" << "showing the Celsius equivalent.\n"; //Loop for displaying the table for (int couter = 0; couter <= 20; couter++) celsius(couter); return 0; } …

Member Avatar for zandiago
0
98
Member Avatar for zandiago

This is what I've got so far: [CODE] #include <iomanip> #include <cmath> #include <fstream> #include<string> #include<iostream> using namespace std; int main() { double numA=0; double numB=0; double productB; double accumulator = 0; cout<<"Your two numbers to multiply are?"<<endl; cin>>numA>>numB; double productA = (numA * numB); if (numA>numB||numA%2==1)//check if larger and …

Member Avatar for zandiago
0
260
Member Avatar for gee1288

hey guys im tryin to do a conversion program im trying to convert pounds to kilograms i input 10 pounds and 4 ounces and it gives me a total of 4.65 kilograms but i want to split that up so it says kilograms and grams so it would be like …

Member Avatar for Ptolemy
0
93
Member Avatar for DREAMER546

hello .. after i write this program there's error i don't know why ? what's the wrong thing? [CODE]#include<iostream> using namespace std; class Account { private: int Acc_no ; double balance; public: void SetAccInfo() { cout<< " please enter your account number\n"; cin>> Acc_no ; cout<< " please enter your …

Member Avatar for DREAMER546
0
112
Member Avatar for gator6688

I have to make a program that enters either a 1, 2, 3, or 4 for 50 people attending a function. Then I have to be able to count how many of each 1's, 2's ,3's, and 4's there were. My 2 questions are: 1.) Would this program be better …

Member Avatar for Salem
0
96
Member Avatar for nitro

please give the c++ coding of how to do the following on a binary tree(BST) using recursion: (1) insert a new node (2) delete a node (3) search a tree

Member Avatar for Narue
0
61
Member Avatar for noona

Hi, if we define a vector class, class vector { private: int size; int* array; ........... public: vector (int n=10); ......... } then we use it in main like this: int main() { const vector v(5); cout <<v(1) <<endl; return 0; } there's a problem with compiling this code, i …

Member Avatar for Narue
0
97
Member Avatar for ambjorn

I am creating a c++ class which randomly puts a number of particles on a lattice and then lets those particles jump on the lattice in a random fashion. I have managed to implement this, but using the random number generators rand(), which I understand is not a very good …

Member Avatar for Ancient Dragon
0
121
Member Avatar for pyramid

Hello - I am working on one of my labs, but I am having difficulty with the results being inconsistent. The passing by reference is working. I tested random data and I don't understand why some works and others produces incorrect results. Data tested: 5, 9, 7 = perimeter of …

Member Avatar for pyramid
0
86
Member Avatar for Subcynic

I'm pretty new to C#, but I've used winsock in VB a lot in the past, anyways, the problem is, I can't get .GetData to work. [CODE]private void axWinsock1_DataArrival(object sender, AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent e) { string R_DATA; axWinsock1.GetData(R_DATA); }[/CODE] Gives error: 'Cannot convert string to ref object' Or [CODE] private void axWinsock1_DataArrival(object …

Member Avatar for truebot
0
820
Member Avatar for toncoolx

Hello there, I met a problem which is to update inputs in a text file, but every time I update is only insert the data, not update. May anyone give me some advises? Thanks~ [code] string input; ifstream fin; ofstream fout; string title,author,category; float price; fin.open("library.txt"); cout << "******Update Book******"<<endl; …

Member Avatar for Ancient Dragon
0
9K
Member Avatar for conan19870619

>>i have defined a stack class using single linked list and a template. as follow: template <class T> class genStack{ public: void push(T a){.....} T pop(){........} .... .... private: SLList<T>: lst; } i know when i want the stack to store int, i should declare a stack like this: genStack<int> …

Member Avatar for Ancient Dragon
0
115
Member Avatar for rogenie

Okay, I got abotu 5 problems solved today and I am on the hardest part! Basically my code ask the user to enter series of random numbers and then use sentinel to mark the end of numbers needed to be entered. Now I want to be able to tell my …

Member Avatar for Duoas
0
943
Member Avatar for ComputerLand

[code] #include <iostream.h> int main(void){ int base; char num; cout<< "Enter a base: "; cin >> base; while((base>=2)&&(base<=10)){ } cin>>num; while((num-'0') < (base)) && (c>='0'){ base>=base*2+(num-'0') cin.get>>num; } cout<<base; cin.putback>>num; return 0; } [/code] Clearly, this program doesn't work very well. I am in need of help. The teacher really …

Member Avatar for Duoas
0
152
Member Avatar for cloudet

Dear all gurus, Given 30 files, with same format (2 columns, column1 is string and column2 is int. contains thousands of lines) and uniform file name, eg: file1.txt, file2.txt,...,file30.txt, How can i read it in a loop, and then load them into my 2D array (eg: string words [filesize][maxline], and …

Member Avatar for Ancient Dragon
0
5K
Member Avatar for Duoas

Hi all. I'm a newbie to this forum so please forgive the odd question as first post... :-) I'm writing myself a [B]property[/B] class (just because I want to play with them). My property header looks something like this (all the usual clutter is removed): [code]#define property_readwrite( c, v, r, …

Member Avatar for Duoas
0
973
Member Avatar for JaksLax

I am having trouble figuring out how to get my non recursive quicksort program to finish sorting. Here is my code [code] #include<iostream> using namespace std; /** * Swaps two items * * @pre x and y are the items being swapped * @post Contents of actual locations that x …

Member Avatar for JaksLax
0
238
Member Avatar for DemonSpeeding

This is my first time working with outputting data to a file, so I've got some rough code that I need some pointers on. [code=cpp] else if (decision == "S" || decision == "s"){ cout << "File name? " <<"("<<filename<<")"<< endl; cin >> newfile; if (newfile == '/0'){ outdata.open("filename"); for …

Member Avatar for Duoas
0
152
Member Avatar for Rhals

Hey guys, Im a beginner in programming...so please bare with me. my project is to create a simple calculator program with a twist. the user needs to input 3 variables which is 1st number, 2nd number and the operator(+ - * /). but when the user wants a square root …

Member Avatar for Duoas
0
73
Member Avatar for blacklocist

Hi all, I have been trying to drop a stored proc for sometime using SMO. I can create with ease but can't seem to drop. Any ideas? I thought it might be permission but for testing used SA account. No luck... [CODE] private void btnCreate_Click_1(object sender, EventArgs e) { SqlConnection …

Member Avatar for blacklocist
0
339
Member Avatar for toolmanx

I didn't want to fill up a thread with a bunch of code, but I couldn't find a way to attach a file to an e-mail using this site's "send a message" system. I would have inserted the .CPP file. This is a basic windows program to run tests on …

Member Avatar for toolmanx
0
133
Member Avatar for pri_skit

I am using CListBox(MFC Class) which have some strings added to it.I want to display different string in different font.Is this possible?How this could be done? regards,

Member Avatar for Ancient Dragon
0
72
Member Avatar for venomlash

I'm new to C++ graphics, and a friend tipped me off to OpenGL. I'm currently trying to work with the GL Utility Toolkit ([INLINECODE]#include gl\glut.h[/INLINECODE]), which I had to download from the web. Due to all the download sites being intended for people with older versions of Windows (I think), …

Member Avatar for Ancient Dragon
0
164
Member Avatar for tracethepath

the last record is getting displayed twice.i hv rechecked everything and cudnt find the error. here is the add n display function. [code=c++] void add() { example abc; int n; ofstream file1("EXAMPLE.dat", ios::binary|ios::app); cout<<"Enter Number Of Records To Add "; cin>>n; cout<<endl; for ( int i = 0; i < …

Member Avatar for Narue
0
2K
Member Avatar for pri_skit

I want to read MS-Excel file using EVC++ 4.0.The file contain strings.How this could be done?Thanks in Advance. Regards, priyank

Member Avatar for Ancient Dragon
0
91
Member Avatar for ksk1
Member Avatar for gator6688

I am trying to figure out when I enter the data instead of asking for person #1: everytime I can get it to ask person #1: then on the next line person #2: and so on. Here is my code so far: [CODE]#include "stdafx.h" using namespace std; int _tmain(int argc, …

Member Avatar for WaltP
0
96
Member Avatar for coolbreeze

Hey guys, I'm new to this board and C++ and was looking for a little help or guidance on this program my professor assigned. She assigned the class to create a BMI Calculator, and I have all the nessesary input given for it to work perfect but im not sure …

Member Avatar for WaltP
0
125
Member Avatar for gator6688

I have to be able to have the program output invalid input if the number is not 1,2,3,4. When I run this program it automatically puts invalid for everything. [CODE]#include "stdafx.h" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { const int People = 5; int i, PeopleTypes[People]; cout << …

Member Avatar for WaltP
0
103
Member Avatar for toncoolx

Hello there, I need to write a function that insert new data into a text file, and I manage to do that, but only for the first row.... When I close my program, and reopen it to key in a 2nd input, it will simplely overwrite my 1st input. how …

Member Avatar for toncoolx
0
222
Member Avatar for erizy

There are situations that exception could be throw within constructor and we usually employ auto_ptr to protect resources. But if we do not have auto_ptr can we use the following technique to handle it? Please search "QUESTION" and see my question. Thank you for helping!!! [code=cpp] #include <cstdio> using namespace …

Member Avatar for Duoas
0
124
Member Avatar for greglobal

I want ot develop a game using windows mobile 5.0 for a smartphone. I am able to play a wav file using Playsound() but unable to play mp3 or sfx files. Can anyone suggest a site or provide a code snippet in C++ for the same ? Thanks abbu

0
58
Member Avatar for DemonSpeeding

I have a file that is representing an image, here's the puddle.img file: 10 22 2222888222882222228882 2222888222882222228882 3333333333333333333333 1111111111111111111111 1111144444111111111111 1111444444411551111111 1114643434345551111111 1111333333311551111111 1111133333111111115114 1111111111111111115543 The first two numbers are the size of the image, rows and then columns. Then I have to pull in the image, and before the …

Member Avatar for DemonSpeeding
0
202
Member Avatar for cms271828

Hello there, I come from a Java background, and I am a very able with java. I would like to try C++ to build a chess engine, since my java chess engine lacks the performance that can be obtained using C++. I've been trying to set up a C++ IDE, …

Member Avatar for Duoas
0
143
Member Avatar for Acidburn

Hello there ive written my own linklist in a template way but it doesnt seem to want to work when i add classes rather than primitive data types to the list... heres the code: [the node itself (template) [code] #ifndef LINKLISTNODETEMPLATE_H #define LINKLISTNODETEMPLATE_H template <class T> class LinkListNodeTemplate { public …

Member Avatar for Duoas
0
122

The End.