49,761 Topics
| |
I need help with a program i am writing( i am new to programing). I am writing a program to Coordinates have the form (x, y, z) Use double variables to represent the private data of the class. Provide a constructor that enables an object to be initialized when it … | |
Hello There, I am currently making a small game in c++ and Qt. In the game, an npc call's the Wander() function which makes it randomly wander around. However, only one of these npc's can call the Wander() function at any one time - Is there a way around this? … | |
Hello I have this problem where my text file is not read in properly to the linked list. It spits out only zeroes. Here is the code I have written. Thanks. include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; struct widget { double R; double S; int … | |
#include <iostream> #include <iomanip> #include <fstream> #include "groupProj.h" using namespace std; const char Avail = '#'; const char Taken = '*'; const int r = 15; const int c = 30; char SEATS[r][c]; int main() { // Declarations for main ifstream inputPrices; double seatPrices[15]; int row; int column; double cost; … | |
Well Guys! I was learning how to read and write class objects from & to file respectivily. And here is a small code that i made...... As far as the code goes its all well.... And i am getting what i want.... But what i want to know is, **where … | |
//Bubble.h #include <iostream> #include <fstream> #include <cstdlib> using namespace std; struct nodeType { int info; nodeType *link; }; class Bubble { public: Bubble(); //constructor //deconstructor //copy constructor //operator= (overloading the = operator) friend istream & operator>> (istream &infile, Bubble & mylist); friend ostream & operator<< (ostream &outfile, const Bubble & … | |
As you can see, I'm struggling with classes. How do I call my fraction plus(fraction second), fraction minus(fraction second), etc. functions? #include<iostream> using namespace std; class fraction { private: void reduce() //I will do this later. {} int num, denom; public: fraction() { num = 0; denom = 1; } … | |
I need a way to do a cast without being returned a pointer to a new address but, the same address as the original. Something like this: derivedClass something_derived; baseClass* basePointer = &something_dervived; derivedClass* derivedPointer = static_cast <derivedClass*> (basePointer); /* my problem is "derivedPointer" isnt assigned the same address as … | |
Hey everyone, I am taking an online C++ class and part of our assignment is to complete a whole bunch of small program snipits on a site called myprogramminglab.com. This one program seems to have me stumped as I am not very familiar with Data structures. Could someone help me … | |
I have been asked to write a coding for calculate GPA by using struct and array. I want to display the ouput for every subjects's name, subjects' code, grade for every subject and GPA for every sem but i coulds't get the ouput i want. I think i had done … | |
#include <iostream> #include <iomanip> #include <fstream using namespace std; const char Avail = '#'; const char Taken = '*'; const int r = 15; const int c = 30; char SEATS[r][c]; int main() { // Declarations for main ifstream inputPrices; double seatPrices[15]; int row; int column; double cost; int answer; … | |
i have started using C++ these days. Initially , I have done coding alot in C language. I have seen that on my onliune judges , there are 2 different versions. Why they have given 2 versions to compile the code ? Can you tell ? thanks if you can … | |
Hi, i'd like to ask for some help about a problem i got... So i got this code right now: Code: const int rows = 5; const int cols = 3; int tocke = 0; int tekmovalci[rows][cols]={{7, 6, 9}, {8, 7, 8}, {6, 9, 10}, {7, 7, 9}, {8, 8, … | |
in this program i'm writing the functions that have qt classes as parameters Qlabel, QSpinbox, etc. are causing compile errors, my other functions work fine i get the same 2 errors for each QT object i use as an argument this is the function definition that uses QT classes as … | |
Hello, guys i have an irritiating problem in the following function: void Sort(Point P, Point &AT50, Point &AO50){ Point AT50_new, AT50_last, AO50_new; while (P != NULL){ if (P->Age <= 50){ AT50_new = new Member; AT50_new = P; AT50_new->next = NULL; // <--from here comes the problem if (AT50 != NULL) … | |
I have the following code that I need to figure out what the output will be. Whenever I try to run it I get an debug error - and it crashes... Somebody else said that it ran fine on their Apple machine. I just need to see what the output … | |
Is it possible to point to a certain index of a value? For example, int x = 2576, is it possible to do something like x[2]? I know you can do it with strings, but can you do it with numbers? | |
I'm newbie in C++ programming and I want to declare a constructor from following code in my main however I'm completely confused about it. Here is the code: #include <vector> using namespace std; template <typename HashedObj> class HashTable { public: explicit HashTable( const HashedObj & notFound, int size = 101 … | |
I need to write a program (using Dev-C++) which can count the number of hyperlinks of a given web page. The main objective is to practice socket programming and try to use HTTP protocol. I am not sure exactly how to go about doing this. Can anyone help me figure … | |
void main() { char line[300]; cout<<"enter ascii code"; cin>>line; int d = strlen(line); for(int i=0; i<d-1; i+4) { if(line[i]!='.') { (int)line[i]; (int)line[i+1]; (int)line[i+2]; int num=(line[i]-48)*100+(line[i+1]-48)*10+line[i+2]-48; cout>>(char)num; } } getch(); } ok, you enter ascii codes like 104.101.121. and the program converts this into a line like 'hey'. But there's something … | |
hello I have the following program in which there is a switch menu and when a person enters 2 the switch menu should take to the second function which is funcTwo but it is not doind so and just gets back to the menu it self i tried switching the … | |
Hey... I have created a prgoram in turbo c++, and i wanted it to export it as a separate file ... that is out of the bin file.. and out of all the other include file, so that it actually runs on every computer who even does not have a … | |
How can I get this [code](http://www.mediafire.com/?o3kg3nii2sfoigh) to work? I am using xcode 4.5. Thanks | |
Hi all I am a noob to C++ and I was getting some source code off the web and this is the second time it has happened, when I compile (Blood Shed Dev) I get a message in the compiler "permission denied" "Id returned 1 exit status" Can anybody help … | |
Im having this weird runtime error whenever I attempt to copy a specific member of an array block. I get this from the output: ASSERT failure in QHash: "Iterating beyond end()", file tools/qhash.cpp, line 293 Invalid parameter passed to C runtime function. Invalid parameter passed to C runtime function. I … | |
i know java c and c++ but i like java just because it was the first language i learned. i ask alot of people and they all seem to say "make game in c++" or "not a good idea to make games in java". what you guys think? should i … | |
Hi, if we take for example 32bits: 1111 1000 0000 1000 0001 1111 1100 0000, how does it become (24bits) 1011 1110 0011 0110 1111 0110 after RLE is applied? Why/how does 1011 represent the 5 1's at the start of the 32bit number? I'm trying to understand the concept … | |
#include <iostream> #include <cmath> #include <stdio.h> using namespace std; int main () { int n, x=0, ans; int b=0; do { x++; cout << "\nINPUT NUMBER: "; cin >> n; if(b<n) { b=n; } } while (x<=10); cout << "\n"; cout << "\nHIGHEST: " << b; system ("PAUSE"); return 0; … | |
Hi, I want to output [chess symbols](http://en.wikipedia.org/wiki/Chess_symbols_in_Unicode) from unicode to console in c++, please tell me how to do that. Im using Dev c++, windows8 and console. Im just a beginner so please keep it simple for me (also tell me the libraries to include please) | |
#include<iostream> #include<vector> #include<algorithm> using namespace std; class Cords { public: int x,y,z; }; class Object:public Cords { int a,b,c; public: vector<Cords> vCords; void insertCords(); void getCords(); }; void Object::insertCords() { Cords theCords; int x=1; do { cout<<"Enter X:"<<endl; cin>>x; cout<<"Enter a b c:"<<endl; cin>>a>>b>>c; theCords.x=a; theCords.y=b; theCords.z=c; vCords.push_back(theCords); }while(x!=0); } … |
The End.