49,757 Topics

Member Avatar for
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
119
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
181
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
122
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
156
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
96
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
96
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
51
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
249
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
213
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
96
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
251
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
88
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
108
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
93
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
60
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
94
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
117
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
83
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
109
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
936
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
145
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
964
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
232
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
149
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
69
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
130
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
71
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
150

The End.