49,761 Topics
| |
Hi I am pasting here code for finding coordinates of a regular polygon. [code] void main() { int no_of_side = 6, side_length=10, i; float ext_angle = 60; float angle=0.0; float x_coord[6], y_coord[6]; for(i=no_of_side-1; i>=0; i--) { x_coord[i] = x_coord[i] + side_length * angle + side_length ; y_coord[i] = y_coord[i] + … | |
Hi, I hope somebody can help me here :-(... this program compiles well and after it crashes. [code] #include "TStack.h" #include <math.h> #include <stdio.h> #include <vector> using namespace std; //FILE *f=fopen("input.txt","r"); //FILE *g=fopen("output.txt","w"); void main(){ int n; scanf("%d", &n); vector <vector<int> > g (n, vector<int> (n)); vector <int> deg (n); … | |
I'm just diving back into C++ after a while of being away. I've created a simple project. But its giving me these stupid errors when I've been trying to do some OOP: main.cpp [CODE=cpp] #include <iostream> using namespace std; #include "oopy.h" int main(int argc, char** argv) { Oopy awesome; cout … | |
[CODE]//6.12 #include <iostream> #include <iomanip> using namespace std; double CalculateCharges (double car1=1.5,double car2=2.0,double car3=24.0); int main () { cout<<" Parking Garage Rates " << endl; cout<<setw(10); cout<<"Car"<<"Hours"<<"Charge"<<endl; double car1; for (int i=1;i<=3;i++) cout<<i<<CalculateCharges(car1)<<endl; cout<<"Total"<<endl; return 0; } //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ double CalculateCharges(double car1, double car2, double car3) { double rate; double hours[3]; … | |
Quick question from someone very new to constructors... If the function body of a class constructor is an array, can I then use any instantiation of that class just like an array? ie: World *anthill and then later... anthill[x][y] or is that wishful thinking? [COLOR="Green"][B]-Ella[/B][/COLOR] | |
Hello, I am working on a Tic-Tac-Toe program in C++ which I want to have AI that will either win or draw every time, but will never lose. I think that this is within my grasp, though I am not at all an expert programmer. I would really appreciate if … | |
I have been working on C++ code optimization to minimize the memory leaks and better performance on HP-UX with aCC I have the following example to share with you I have a structure SYS_LC_DETAILS_CDA for which I have allocated a memory using malloc and then memset and then calling a … | |
can anyone give me the program in turbo C++ for the conversion of decimal numbers to hexadecimal numbers, octal numbers to decimal numbers. it will be so kind of you. thanx. | |
can anyone help me do this i am utterly confused and have no clue what to do Page 1 of 2 Overview: Write a C++ program to select, for purchase, for a particular month, offers to supply coal to an electric generating station. This program should read a user-specified input … | |
I was going through walkthoroughs as a practice for my final and i came across this question. Although i was able to do it correctly, I was not able to get the presence of a colon in one of the lines(line 35): [CODE] #include <iostream> using namespace std; class base{ … | |
Hi everyone, I need to pass a vector to an external function and then have that function read the items within the vector. I'm assuming I have to pass the vector by pointer. Other than that, there's no real reason I'm using a pointer here. Below is a bit of … | |
I have a few questions about c strings, string literals, c++ string objects and how pointers and constantness all come together. I am wondering why a c string can be set like this but can't be changed dynamically with an assignment operator like this. [CODE] char str [] = "string1"; … | |
[code=C++] #ifndef DARK_OBJECT_H #define DARK_OBJECT_H #include "DarkGDK.h" namespace DarkObject { class Object // abstract { public: Object(); virtual void x() = 0; protected: int imageID, spriteID; }; class Rect2D { public: Rect2D(int x, int y, int width, int height): x(x), y(y), width(width), height(height) {}; int GetX() const {return x;} int … | |
Binary tree I have this problem to submit it tomorrow I have to do it pleeze help me Add the implementation of the following functions to the class binaryTreeType: 1. nodeCount that takes as a parameter a pointer to the root node of a binary tree and returns the number … | |
Hello. I have been learning C++ for a while now. I know how to create C++ Console applications, and im wondering if theres any good tutorials on using Sockets/Winsock2 in C++ Console apps. Please don't say I should learn Windows API, or MFC, I already know about those, and I … | |
I am taking a intro programming course currently. I am stumped by my current assignment. The program is suppose to do the following using functions only (no other code allowed in main): 1. Get data from an input file and put into a parallel array. 2. Find and display the … | |
Hello, I have a program that I'm writing and it seems to just stop. I've looked at the code and I can't seem to figure it out. This is for a class, so please don't just fix it, but please tell me how to go about fixing it, I want … | |
im having a bit of trouble with this for loop. can somone show me what im doing wrong? [code]runcount = runcount + 1; cout << "Type a number: \n"; cin >> s; guesssheet[runcount] = s; for(int y = 0; y < runcount; ++y) { if(guesssheet[y] = s) { system("cls"); cout … | |
Hello. My first thread here @ daniweb. Im stuck on some source code. I am trying to create a small program that allows user to input '1' or '2' for class selection on an airplane. 1 for first 2 for economy. the plane capacity is 10, which is also the … | |
I need simple DLL to play audio file (at lest MP3). As simple as possible for me to use it in practicing playing with DLLs | |
I did some C++ a few years ago, and now am starting again. One of the first things I am going to try is getting SOs to work. Can somebody recommend some good tutorials for me to get started? (I know C++ pretty well, just a bit rusty) | |
Lets say we have a string named "pie" with the value of "do_something". We also have a function with the name of "do_something" Is there a way to call the function with the name of the value of pie? In this case, do_something? There is a way to do this … | |
Hi, im a newbie in programming with only couple of months experience. This game is a connect 4 game but works basically like a tic tac toe because insted of a piece dropping at the bottom of the board, it would stay in the selected area like tic tac toe … | |
After using MFC, I felt like throwing it away. I thought to move on to Win32 API programming (I work on Windows platform.) But then, it is all C. I dont say i dont like C, but is there any better OO alternative to MFC for Win32 platform? Or should … | |
Hi, I was making a program like an array which reads the list and tells what position is it in the list. For example: For letters its: list[2]{'A','B'};Its like a search program and it works because it reads the list. So now I was figuring out on how it will … | |
im trying to show what is stored in arrays, basically to make sure my program is working fine, i have got it to print which element in the array it is, but how do u access the array and show what value is stored in it. my code is basically … | |
Hi, I am on Windows xp professional edition and looking for a free develeopment tool/ide for some self c++ learning. The one I can across is Dev-C++ 5 (currently beta) from [URL]http://www.bloodshed.net/devcpp.html[/URL] It is supported on XP but it is still beta version and I want something stable. Can any … | |
the program i have to write involves a dynamically linked stack to evaluate if the grouping symbols '[B]([/B]' , '[B])[/B]' , '[B]{[/B]' , '[B]}[/B]' , '[B][[/B]' , '[B]][/B]' in expressions are balanced. The expression is input through keyboard. For example: expression: {A+(B-C)*D} is balanced expression: T+{(R+M)/G-V*L is not balanced expression: … | |
So basically, my assignment was to write quick sort and merge sort using both vectors and arrays, and time how long it takes to sort the the arrays and vectors of various sizes. However, the code is producing inconsistent results. Sometimes it seg faults, other times it produces unfriendly messages … | |
[CODE][/CODE] average=a[counter]+b[counter]+c[counter]+d[counter]/12; can someone can help me? modify to modify this code using an for loop? thanks |
The End.