49,761 Topics

Member Avatar for
Member Avatar for dpsh

Hi, pls try to observe the size(i.e. total) of object for below program and in different cases as commented out. #include<iostream> using namespace std; class B { int x; // try by commenting either data member and observe the object size int *p; public: virtual void show(){} }; int main() …

Member Avatar for dpsh
0
92
Member Avatar for szejna

In the function for overloading the >> operator I am getting this error: 84`rationalize_number' undeclared (first use this function) this is the function: istream& operator >>(istream& in, Rational& rational1) { char tempChar; int numerator = rational1.numerator; int denominator = rational1.denominator; in >> tempChar; if(tempChar == '(') { in >> rational1.numerator …

Member Avatar for rajenpandit
0
116
Member Avatar for wids101

this loop is running more times then i want to and when the user puts in the wrong number how do i print out an error. #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { string answer; int soda; do { cout << "Choose a drink or …

Member Avatar for wids101
0
96
Member Avatar for iamthwee

At the moment I'm using getPixel() to scan the screen and get coord colours, but it's seriously slow. What's the best way to do it? Get a screen grab as a .png or .jpg and then process it. Would this be faster...

Member Avatar for iamthwee
0
100
Member Avatar for davecoventry

I'm trying to port opensource C++ code into my own Pascal application. Specifically, I'm using libredwg source to read an AutoCAD drawing file so that I can extract text attributes and populate a database using Lazarus. char* copy_bytes_16(char *dst, char *src) { *(uint64_t*)dst = *(uint64_t*)(src + 8); *(uint64_t*)(dst + 8) …

Member Avatar for triumphost
0
215
Member Avatar for dustin.short.5

So I am taking C++ at thomas edison state college for a degree. I needed a computer course so I chose C++ instead of PLCs. The reason being is that I used to do some basic coding back in the apple IIe days. I apparently don't have the attention span …

Member Avatar for WaltP
0
334
Member Avatar for crissium

this game is called "pig latin" it spit all the string, put the first consonant to the end and adds "AY" to the end. for example --> "this is test" --->"histAY isAY estAY". it gives me string subscript out of range. thanks #include <iostream> #include "conio.h" #include <string> #include <sstream> …

Member Avatar for crissium
0
157
Member Avatar for wids101

#include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { int soda; cout << "Choose a drink or 6 to quit:"; << endl; cout << "1. Coke $1.00"; << endl; cout << "2. Water Free"; << endl; cout << "3. Sprite $1.25"; << endl; cout << "4. Dr. …

Member Avatar for wids101
0
390
Member Avatar for valenluis
Member Avatar for L7Sqr
0
35
Member Avatar for Dwayne2long

I'm writing a program that unable me to extract timing(time that i used to finish typing my password). When running my program, i need to shutdown/close all the background processes to prevent any delay whn i extract the time. Any coding(C++ or C#) can help me to shutdown/close all the …

Member Avatar for rubberman
0
128
Member Avatar for jdh1231

Hi, I am trying to put random numbers in array, and use the array for other functions. However, I am stuck on inputting and displaying that array with random numbers. Can someone help? Please ignore other cases, and focus on case 0, which is displaying the elements of the array. …

Member Avatar for np complete
0
319
Member Avatar for Kamina00

Hi I am new to C++ and I just need some advice on declaring dynamic arrays. Take for example this code block: int a=0; cout << "Enter Arr size: "; cin >> a; int arr[a]; My compiler gives no error doing this but looking around the web I see many …

Member Avatar for Kamina00
0
219
Member Avatar for quantumss

I'm causing input letters to write ones into variables through an array. I'm trying to count the occurences of ones in a variable. Lets say I input aaaaa. The count output displays 12345. Instead of outputting the whole count of numbers, I want to output the biggest number in the …

Member Avatar for np complete
0
218
Member Avatar for np complete

This is a factorial program which uses array to calculate large factorials. The problem is sometimes if I enter 1000, it gives the output but stops working there after. I tried it with 2000, 3000, it works fine. I cant understand its erratic behaviour? Is there any problem with my …

Member Avatar for np complete
1
120
Member Avatar for Brian_L

#include <iostream> using namespace std; class Lists{ public: void insert_head(int insert); void remove_head(); void insert_tail(int insert); void print(); Lists(); private: Node *head; Node *tail; }; struct Node{ int data; Node *link; }; int main() { Lists temp; temp.print(); return 0; system("PAUSE"); } Lists::Lists(){ head = new Node; head->Link=tail; tail->Link=NULL; } …

Member Avatar for JasonHippy
0
147
Member Avatar for hillman.chen

Hi guys, I am trying to write a program that will ask for users name, birthdate and pet and from those info I need to use a random number generator to select 6 char from the name and animal and 2 numbers from the birthdate. This is my code to …

Member Avatar for vijayan121
0
417
Member Avatar for subith86

I have a code which gives the maximum value I can get by filling the knapsack with the optimal set of weights. int arr[5] = {0, 0, 0, 0, 0}; int Weight[5] = {2, 5, 8, 7, 9}; int Value[5] = {4, 5, 7, 9, 8}; const int n = …

Member Avatar for Lucaci Andrew
0
308
Member Avatar for riahc3

Hello How do I write a C++ program targeting a x86 version of Windows CE in Visual Studio 2008? It doesnt show me Windows CE and more so, all it targets is ARM. Thanks

0
65
Member Avatar for linabeb

hi all i would like to ask...ermm i have an erorr it say that my winscard.h no such file or directory...when i search it in my include folders there is no winscard.h in that folders..so...what should i do..is it somekind relate to the pcsclite.h ??? do i need to install …

Member Avatar for rubberman
0
2K
Member Avatar for juliani91

A corporation has six divisions, each responsible for sales to different geographic locations. Design a DivSales class that keeps sales data for a division, with the following members: • An array with four elements for holding four quarters of sales figures for the division • A private static variable for …

Member Avatar for rubberman
0
504
Member Avatar for TheNotoriousWMB

I am building an application that calculates travel time necessary to reach a user selected destination from predetermined city based upon an estimated travel speed determined by the user. For this program I am to utilize classes/class source files. When compiling my source file I continuously get the error “undefined …

Member Avatar for TheNotoriousWMB
0
295
Member Avatar for hello10
Member Avatar for Some Dude

So basically I am new to API programming and teaching myself. I've done a bit of console C++ that I got off of.... an internet tutorial. The story is the same here too. I am somewhat aware of what the lines of code do, though I am not yet a …

Member Avatar for neithan
0
310
Member Avatar for Darth Vader

Hi, The below TimeZone code returns the following string: "(GMT-05:00) Eastern Time (US & Canada)" TimeZoneInfo FromZoneID = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"); What I wonder how it is possible to do is how I create the TimzeZoneInfo object by using the string directly. I have tried this but it doesn´t work. …

Member Avatar for BobS0327
0
142
Member Avatar for noblepants

Hi every I'm new here and new to programming. : ) Here is a practice assignment I have completed but seemingly not correctly. Can anyone offer advice as to my error? It compiles correctly but using some test numbers I only ever recieve that the circle has no x intercepts …

Member Avatar for noblepants
0
414
Member Avatar for paul9519

hi everyone i have a problem with this code below. when i try to read all the files in a directory i can but when i try to put them in a vector, it doesn't work, all the elements in the vector become the last element added. I'm not sure …

Member Avatar for Tumlee
0
212
Member Avatar for nquadr

Hi, I am trying to display the contents of a vector. The vector is defined from a class I created. I seem to be only storing the most recent values in my vector. I am not sure where my logic is incorrect. I am trying to store multiple objects in …

Member Avatar for nquadr
0
219
Member Avatar for jdh1231

Hi. I am pretty new to C++, and trying to understand how to use switch and case statement. So I was practicing with some bubble sorting algorithms, and it seems case 1 and 2 is not workig in my code. Can someone figure out why it's keep breaking please? The …

Member Avatar for NathanOliver
0
169
Member Avatar for mimah1

#include <iostream> using namespace std; char chessboard[100][100] ={' '}; int n; int savingposition[100][2]={ }; //checking rows.... bool checking (int row, int column){ for(int i = 0; i< n; i++){ for(int j = 0; j < n; j++) { if((j+i== column+row|| column - row == j-i || i== row || j …

Member Avatar for mimah1
0
153
Member Avatar for ekarem

Hi I would like to save integer values from 0 to n ( n = 112 e.g.) to a char array. How can I do this? char numbers[n]; for (int i = 0; i<= n; i++) { numbers[i] = i // or numbers[i] = 'i'; when I write code like …

Member Avatar for WaltP
0
225

The End.