49,761 Topics
| |
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() … | |
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 … | |
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 … | |
| 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... |
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) … | |
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 … | |
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> … | |
#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. … | |
Whats c++ equivalent of this? while(scanf(*)!= eof){ //code } | |
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 … | |
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. … | |
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 … | |
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 … | |
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 … | |
#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; } … | |
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 … | |
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 = … | |
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 | |
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 … | |
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 … | |
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 … | |
How to make a program that prints out 10 stars with using cout or for loops or while loops. | |
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 … | |
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. … | |
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 … | |
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 … | |
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 … | |
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 … | |
#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 … | |
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 … |
The End.