49,757 Topics

Member Avatar for
Member Avatar for stevanity

When I compiled this program... [CODE]#include<iostream> using namespace std; class base { public: virtual void show() { cout<<"\n Base class show:"; } void display() { cout<<"\n Base class display:" ; } }; class drive:public base { public: void display() { cout<<"\n Drive class display:"; } void show() { cout<<"\n Drive …

Member Avatar for gerard4143
0
198
Member Avatar for chamika.deshan

Hi I came accross a code and i din't understand it Template.h [CODE] #define FRIEND_NEW template<class T> friend inline T* ::safe_new(const char*,int); template<typename T> inline T* safe_new0(const char* file, int line) { T* ptr = new T(); return ptr; };[/CODE] A.h [CODE] #include "Template.h" class A { FRIEND_NEW protected: A(); …

Member Avatar for L7Sqr
0
161
Member Avatar for Wiki_Tiki

Hi, I'm a real newbie at C++, and I'm having a ton of trouble. You see, What I need to do is convert an std::string into a system::string^ so I can display it in a textbox, and I haven't found any way of doing so :icon_confused: . I always get …

Member Avatar for RhondaCos
0
2K
Member Avatar for hkhk106

I have a son who's in grade 8 and he is show a great deal of interest in computer programming. What is a good book for him that is easy to read, understand and detailed? Money is not an issue. Thanks

Member Avatar for sumtaru
0
239
Member Avatar for Navlag

Hi there. I have a few hundred/thousand macro enabled spreadsheets that need to be uploaded to a database. The spreadsheets have a button that copies the data over to the database and it prompts the user for a username and password in order to do so (same for all files). …

Member Avatar for toske
0
196
Member Avatar for Loafer
Member Avatar for WaltP
-5
151
Member Avatar for ruval002

so i have the following code, it inserts a number to a list and then i call my sort function which is below this function, the problem is that my sort function takes forever, is there a way i can implement my insert function so that everytime it inserts a …

Member Avatar for Ancient Dragon
0
130
Member Avatar for The_Purple_Mask

I've tried for some time to make the following code run properly. The problem is in the comparison function of sort(comp). It compares 2 doubles but in some cases it causes the program to crash with the message "Debug Assertion failed! Program: retrace.exe File:c:program files (x86)\microsoft visual studio 10.0\vc\include\algorithm Expression:Invalid …

Member Avatar for Fortran IV
0
205
Member Avatar for Dewey1040

I'm writing a program where I take in a file and need to grab strings of n length (n = 3, 4, 5, 6 ,7 or 8). The issue I'm having is I need to grab these strings in a specific window. So if n = 3 I need to …

Member Avatar for L7Sqr
0
146
Member Avatar for Labdabeta

How do I do assembly code with the mingw-g++ compiler. All the websites I checked say that this should work: [CODE]int add(int a, int b) { int c=0; asm("mov %[aVal],%eax;add %[bVal],%eax;mov %eax,%[cVal]" : [cVal] "=i" (c) : [bVal] "i" (b) : [aVal] "i" (a)); return c; }[/CODE] But instead I …

Member Avatar for gerard4143
0
1K
Member Avatar for loumbut

Hi, a friend recommended the following winsock code to me. [CODE] #include <stdio.h> #include <winsock2.h> void abc(char *p) { char *ptr; p[1000] = 0; ptr = strchr(p,(int) "\r\n\r\n"); if(ptr) ptr[4] =0; printf("%s", p); } int main(void) { WSADATA ws; int d; char aa[1001]; struct sockaddr_in a; SOCKET s; int ii; …

Member Avatar for Fortran IV
0
1K
Member Avatar for NickPatton

I'm working on an assignment where I have to write my own raisePower function to take a base and a power and compute the product. The assignment states that the function needs to return a long but all input/output values should be ints. The code compiles and runs but does …

Member Avatar for Caligulaminus
0
186
Member Avatar for alastair1008

I'm just starting out in C++ and want to use TextOut to print a character that is generated at runtime based on keyboard input but am having trouble converting TCHAR to LPCWSTR so that it can be used in the TextOut method. my code is [CODE] LRESULT CALLBACK WndProc(HWND hWnd, …

Member Avatar for Ancient Dragon
0
268
Member Avatar for bennetk2

I can't figure out what this error is saying. Error: C:\Users\Kyle\School\CS 372\Statistician\Statistician.cpp||In function 'bool operator==(const statistic&, const statistic&)':| C:\Users\Kyle\School\CS 372\Statistician\Statistician.cpp|225|error: passing 'const statistic' as 'this' argument of 'float statistic::sum()' discards qualifiers| C:\Users\Kyle\School\CS 372\Statistician\Statistician.cpp|225|error: passing 'const statistic' as 'this' argument of 'float statistic::sum()' discards qualifiers| C:\Users\Kyle\School\CS 372\Statistician\Statistician.cpp|226|error: passing 'const statistic' as …

Member Avatar for gusano79
0
332
Member Avatar for skannigan

As Part of an assignment one of the requirments is to convert a date into month format. that is the user must enter start month and year of employment and end month and year of employment for example 4 1980 till 7 2009 (mmyyy) these two dates must be coverted …

Member Avatar for skannigan
0
160
Member Avatar for arold10

I am working on an assignment that I currently have. I am using cin.getline to input the title of a book. The problem is every time I run it here is how it shows up in the command prompt [B]Title: Price: $_[/B] Why is it doing this? cin.getline seems to …

Member Avatar for deceptikon
0
122
Member Avatar for mrnutty

Check out the [URL="http://en.wikipedia.org/wiki/Boggle"]wiki[/URL] for boggle. You job is to create a program that generates all possible words that can be constructed given the boggle board and a dictionary. A word has to be of length three or greater and the word has to exist in the dictionary. For example …

Member Avatar for mrnutty
0
264
Member Avatar for miturian

(I hope this is not already covered in another post, a quick search didn't turn up anything in the archive) So, I have recently made a lot of changes to a program, and want to quantify what those changes have done to the speed. Let us call the old version …

0
96
Member Avatar for ruval002

i need help with my makefile. This is my first time dealing with one.I have ,ll.C and main.C, and one header file called ll.h main.C has the header file ll.h included and some other libraries ll.C has the header file also. and when i compile it i get this error: …

Member Avatar for caut_baia
0
166
Member Avatar for sohaib paracha

#include<iostream.h> #include<iostream> #include<iomanip.h> #include<windows.h> void main() { int a,b,c,h,m,s,l=44; cout<<setw(l); cout<<"DIGITAL CLOCK"<<endl; cout<<"\n"; cout<<"Enter time in hours = "; cin>>a; cout<<"Enter time in minutes= "; cin>>b; cout<<"Enter time in seconds= "; cin>>c; start: for(h=a;h<24;h++) { for(m=b;m<60;m++) { for(s=c;s<60;s++) { Sleep(1000); system("CLS"); cout<<h<<":"<<m<<":"<<s<<endl; } c=0; } b=0; } a=0; goto start; …

Member Avatar for Eagletalon
0
188
Member Avatar for VBNick

I just finished up writing a class to encapsulate a pointer-to-pointer that provides auto-release functionality like shared_ptr<T>. I'm curious though, does something like this already exists, in the standard library, boost, ect? I know the idea exists, because in the Unity Engine, when you call Destroy(gameObject), any and all references …

Member Avatar for VBNick
0
144
Member Avatar for Whoaa512

search and didnt find anything that was close to this. so my assignment is to simulate a simple authentication, where the user enters their original pin or password(numbers only). it must use arrays to assign the password a pseudo-random assignment of 1-3 for digits 0-9. after that the program clears …

Member Avatar for Whoaa512
0
345
Member Avatar for Reclaimer0418

I've been staring at this code for about 3 hours, changing things back and forth and making myself feel really stupid....please, anyone, help me. [CODE]#include <iostream> #include <cstdio> #include <string> using namespace std; int main() { //declare variables int gas, time, distance; // could have used \n all in one …

Member Avatar for MandrewP
0
767
Member Avatar for inspire_all

i am a bit confused.i am feeling that one should be expert at data structures rather than language.i am learning c++ this semester,learning oop and data structures.[COLOR="Red"]is data structures more important than language?[/COLOR]what can get u into a good company?

Member Avatar for WaltP
0
125
Member Avatar for Diamond3x

What is "std" and "::" .Like for example, std::cout. Now i know what is cout for but what is std and what are these "::" for?

Member Avatar for neartoyou
0
253
Member Avatar for juce

I need a code which will print union of two strings. for example string1="1,2,3" string2="3,4,5" and print the result string3: 1,2,3,4,5 Could someone help me how to solve this?

Member Avatar for mazzica1
0
1K
Member Avatar for mjacqu4

Hey, I'm a bit rusty at c++ and I'm sure that I'm just missing something stupid, but I have a class that takes in an ifstream object in its constructor. In my main function I create an ifstream, open a file, then pass the ifstream object by reference into the …

Member Avatar for mjacqu4
0
842
Member Avatar for juss2022

Hello everybody. I've a question. I tried to change font size of textBox named "textBox1" Here is the function of the NumericUpDown: [CODE]private: System::Void numericUpDown2_ValueChanged(System::Object^ sender, System::EventArgs^ e) { String^ Num2 = this->numericUpDown2->Text; this->textBox1->Font->Size = Num2; };[/CODE] Errors that occur: [CODE] error C2039: 'set' : is not a member of …

Member Avatar for Ancient Dragon
0
454
Member Avatar for mz_rigel

Hi, I'm trying to write a program that converts a base x to a base y. It says that we are suppose to use two functions to do so: one that converts base x to base 10 and one that converts base 10 to base y but I don't understand …

Member Avatar for WaltP
0
1K
Member Avatar for juce

I had code in C++ which works really. I need to find alternative solution for this kind of solution... Could some help me how to change the code ... [CODE]#include <string> #include <iostream> using namespace std; int main(){ string s1="abv"; //Set up string 1 string s2="vxz"; //Set up string 2 …

Member Avatar for histrungalot
0
128

The End.