49,761 Topics
| |
hi plzzz i need ahelp to know what rong with this program the problem is in the display function the code [code]#include <iostream.h> #include<string.h> class Employee { private: char number[55], name [55], salary[55]; public: Employee(); ~Employee(); void set(); void display (); }; Employee::Employee() { cout<<"The constructor called"<<endl; } Employee::~Employee() { … | |
[code]#include <iostream.h> void askforprices(); double rate (double old_price, double new_price); int main() { askforprices(); return 0; } void askforprices() { double old_price, new_price, rate; cout << "Please enter old price\n"; cin >> old_price; cout<<"Please enter new price\n"; cin >> new_price; rate = rate(old_price, new_price); //points to this location for an … | |
In the following code I am giving an int value to class using type casting-- [CODE]#include<iostream> using namespace std; class A { int a; float b; public: A() { a=0; b=0; } A(int m) { a=m; cout<<"\n values are"<<a<<endl<<b; } }; void main() { A a1; a1=1; }[/CODE] The members … | |
Hello, I'm working on a program and I'm close to finishing it, but theres one (or two) parts that I'm unsure of depending on how I set it up. The program has to have a user defined function flip(). Flip is only supposted to randomly generate a 0 or 1, … | |
I am trying to edit a field as it is being input, not waiting for the <CR> using Microsoft VC Borland will allow a "myChar = cin.get();" and will return the char immediately to program control. Microsoft insists that it must be followed by a <CR> before the program can … | |
I am having trouble getting my program to store values and to be changed throughout the functions. Any help would be much appreciated. Here is the code. [code]#include <iostream> using namespace std; void DisplayMenu(void); void Enter_Inventory(); int Display_Inventory(int inventory_number_coke, int inventory_number_pepsi, int inventory_number_cd, int inventory_number_hires); void Purchase_Soda(); int main() { … | |
We've been told to design our own class for strings. I've sat down and managed everything so far but I've stumbled accorss something. We've been asked to implement a concat algo. [code] strings* strings::concat(strings *s) { char str[10]; for(int i=0; i<5;i++) { str[i]=m_psz[i]; } for (int j = 0 ; … | |
Hi everyone, I spent 2 hours trying to make this code work but I couldn't do it. Can someone point out what I'm missing or what I'm doing wrong? Thanks in advance. [CODE] #include<iostream> using namespace std; bool isFactor(int a,int b); int main() { int num1, num2; cout<<"Enter a number: … | |
I am using the Dev-C++ compiler. Right now I am having a problem using GLUI. I have installed GLUT and tested some examples, which worked. I have installed the devpack (I believe that is what it was called) for GLUI and am unable to do any examples. The includes are … | |
As a first year c++ coder, i was intreaged by the language as soon as i sat down in the classroom. However, on a school assighnment,I have come upon an error that is unfamiliar to me. The assighnment was to simplifly a program that was far too complex. The end … | |
Hi guys....i want to access MSAccess using C++....don't know how to.......suggest me some ways to do that | |
I have been given a lab assignment that should take a prefix expression such as *+-23/427 and use recursion to solve its infix equivilant ((2-3)+(4/2))*7. So far, the code I have will work for an equation with 2 or 3 numbers. Any more and it starts returning weird results. Its … | |
What is the code for ( e^x = 1 + x/1! + x^2/2! + x^3/3! + ..... ) anyway can help me, plzzz :cry: :rolleyes: | |
[code] #include <vector> #include <iostream> using namespace std; class Test { public: Test() { cout<<"In TEST constructor"<<endl; } ~Test() { cout<<"In TEST destructor"<<endl; } }; int main() { Test t1; vector<Test> vec; vec.push_back( t1 ); cout<<"About to clear vector"<<endl; vec.clear(); } [/code] I suspect I'm missing something fundamental. When I … | |
I've got a program to do for a class I'm taking. I've got most the code written but I can't get the two classes to play together like I want them to. Here is the relavent part of the assignment: [quote] A concordance is an alphabetical listing of all words … | |
How Can i Create a final class in C++? i have tried by making constructors private . but i want to know an efficient way of doing this? | |
I am very new to this and i really need some help :cry: Objective: Understanding of static data types (arrays), traversals, searching and insertion into arrays. Description: In this assignment, you will create a game similar to that of 'Wheel of Fortune'. While the show itself lacks any real worth … | |
hi everybody I beg to say that I have three numbers. but i want to know that which number is random these are number 1 73163474394643734240 number 2 42651524357702920737 number 3 24965462478679919220 | |
Im having trouble sending a bool type to a function which returns a char string to a string. I have provided the code below [CODE] /* Name: bool2.cpp Copyright: Author: Toshkin Date: 06/09/05 21:56 Description: passing string to boolean function returning boolean to */ #include <iostream> #include <cstring> using namespace … | |
Well, I'm writing a physics calc and I'm having problems. When my friend tries to run it, he gets this [url=http://www.kc8onw.net/~kelvad/images/untitled.bmp]error[/url]. I was wondering what piece of the code wants that .dll file. I think it has to do with the .rc file, but I could be wrong. I'm only … | |
How would I make my command line program respond to what a user types in? Im reading C++ for Dummies at the moment, and I was wondering what I would do to make it respond to what a user types in. Example: I declare a variable. I start a new … | |
hi, I've been staring at my program code forever now and I'm going in circle. I don't know what I've done wrong. Can anyone please help? I'm supposed to design a month class that the following private members: 1) name: a MyString object that hold name of a month such … | |
[code] //Clifton Copeland //Excercise 6.27 //This program outputs Fahrenheit and Celcius range charts. //C = (F-32)*5/9 //F = C*9/5+32 #include <iostream> using namespace std; int cTable; int fTable; int main() { cout << "Choose which table you would like to display." << endl; cout << "Press C for conversions to … | |
For some reason this code is not correctly displaying the output....Is it a compiler issue? I'm not getting any affect from the width method, nor from the fill method. However, when I include <iomanip> and make a call to setw(int) then it works, but this code doesn't: Code: #include <cstdlib> … | |
Hello, anyone familiar with ansiString? Have a problem involving a string "1 1", should read "11". I want to get rid of the space in the middle. Can't change it to a character string or std::string so that isn't an option. Will i have to compare each character inturn with … | |
Hello, I've been reading Narue's Timesaving Tips and found this code from Dave Sinkula [code] #include <iostream> #include <vector> #include <iterator> using namespace std; int main() { int a[] = {1,2,3,4,5}; vector<int> v(a, a + 5); vector<int>::const_iterator it, end = v.end(); for (it = v.begin(); it < end; ++it) { … | |
How good do you have to be in C++ / C in order to enter the world of Open GL? | |
Hi :o , I would like to know if it is possible to write a console program in [B]MS Visual C++ 6.0 [/B](ATM transaction program), that stores data to a database such as [B]MS Access 2002[/B] or [B]Oracle 9i[/B], through [B]ODBC[/B] :?: I've searched all over the net and I … | |
I'm writing a basic piece of code to perform a successive approximation algorithm, however, when it runs the approximation loop, it seems unable to distinguish between a positive and a negative number in that it runs both if statements. The code is shown below, and if someone could point out … | |
Hello All, I am trying to convert structures to Byte stream(Serialization). I have one concept, Now I am converting each structure object to char pointer, but for structures with pointers this logic wont applicable. can any one help me with any logic for serialization in C/C++ |
The End.