49,761 Topics

Member Avatar for
Member Avatar for kra9853

Heres the question:Develop the code and example values necessary, to demonstrate to a user, the differences in execution of the following four statements: [CODE]{ ++count; count++; --index; index--; }[/CODE] here is my attempt [CODE]int main (void) { int count,index; count=1; //intialize count while (count <= 10) { cout<<count<<" "; ++count; …

Member Avatar for getnit
0
98
Member Avatar for hondros

Hello, I'm trying to take a C array of char's and trying to take all of the spaces out of it. Yet I keep running into a segmentation fault. Can anyone help me here? [code] #include <stdio.h> #include <stdlib.h> int strlen(char* Str) { int toret=0; int i=0; char tmp = …

Member Avatar for VernonDozier
0
204
Member Avatar for aaronmk2

Can someone explain to me what is going on in this code. I am leaving comments by each line. [CODE] void qs::quicksort(int set[], int start, int end){ stack<int>s;//starts a stack to hold them elements s.push(start);//why push two elements, why not one so the while loop works s.push(end); while (!s.empty()) { …

0
58
Member Avatar for thetooth

So i am working on a platformer which has tiled graphics. The physics system on the other hand is not tiled, it uses vector boxes as an efficient way of doing collisions and the actual tiling is done at draw time. Heres the problem, all of my tiles are 16x16px …

Member Avatar for thetooth
0
100
Member Avatar for tfmontague

How do I make an array (or an abstract data type) which can hold different data types? Then use those data types to create instances. I want to do the following: [code] int arrayType[3] = {bool, int, char}; /*arrayType[0]*/ myBool = true; /*arrayType[1]*/ myInt = 2; /*arrayType[2]*/ myChar = "a"; …

Member Avatar for alwaysLearning0
0
187
Member Avatar for manofhouse

I cannot seem to correct the remaining errors in the code. This is the header [CODE]#ifndef DECIMAL_H #define DECIMAL_H #include <iostream> using std::ostream; using std::istream; // class Decimal definition class Decimal { public: friend istream operator>>( istream &, Decimal & ); Decimal( double = 0.0 ); void setInteger( double ); …

Member Avatar for gerard4143
0
189
Member Avatar for toferdagofer

Im having problems with my input validation. Its not working correctly. Keeps repeating the validation loop even when i enter something that should be correct. basically im trying to make it so that the only valid answer is either uppercase or lower case letters a-d. [CODE]#include <iostream> using namespace std; …

Member Avatar for Lerner
0
149
Member Avatar for miha2

Hello. So, I'm a newbie, and this is my second hard assignment. In this assignment, I have to decrypt the message from the teacher (well, not only this, it should open and decrypt any text file). So, the example line would be: [I][B]Ftq Pqoxmdmfuaz ar Uzpqbqzpqzoq ar ftq Ftudfqqz Oaxazuqe …

Member Avatar for miha2
0
734
Member Avatar for MasterGberry

I have a feeling my logic is off here.....crashes randomly depending on input [CODE]//Exc_6.cpp - practice with arrays #include<iostream> using namespace std; void fillArray(double array[], int size); void showArray(const double array[], int size); void reverseTheArray(double array[], double reveseArray[], int size); int main() { int size; cout << "Please enter the …

Member Avatar for MasterGberry
0
90
Member Avatar for hiddepolen

Hi guys, I need some help with sprintf. I get the general idea, and I think everything works, but my MessageBox will not diplay the right text. [CODE]int a = 25; char buf [80]; sprintf(buf, "%d", a ); MessageBox(NULL, (LPCWSTR)buf, L"Sel Change", MB_OK);[/CODE]

Member Avatar for hiddepolen
0
131
Member Avatar for TinhornAdeniyi

This is supposed to be a code for a video game store [CODE]#include<iostream> #include<fstream> using namespace std; ifstream infile; struct VideoGame { string Name; string Genre; string Publisher; string Developer; string Platform; string Price; int count; VideoGame *link; }; void CreateList(VideoGame*& first, VideoGame*& last); void CheckOut(VideoGame*& first, string title); bool …

Member Avatar for TinhornAdeniyi
0
233
Member Avatar for burcin erek

i made a class test program with telephone directory. it writes name and telephone number but not surname i have used return name,surname which does not carry both string. is it possible to do them without writing another function script. thanks in advance [CODE]#include <cstdlib> #include <iostream> using namespace std; …

Member Avatar for jonsca
0
99
Member Avatar for vbx_wx
Member Avatar for SgtMe
0
56
Member Avatar for wrhurst

Hello all, I want to change the following code to have the user enter ANY NAME to see if the person is present in the array. I'v been trying for a couple hours now but keep getting errors. There's more to this problem but I have to get past this …

Member Avatar for wrhurst
0
167
Member Avatar for wdearth

I'm supposed to create a bill for a catering group utilizing at least two functions, which functions could I use for this and how will I use them? I've done it with mainly if and else statements and simple calculations, any functions I can use? #include<iostream> #include<iomanip> #include<string> using namespace …

Member Avatar for mtbs1826
0
226
Member Avatar for .:Pudge:.

Alright so I have to create a B-tree of order 'n', where the user puts in a desired 'n'. I borrowed and modified code of a B-tree of order 5, but I can't get it to work and it crashes. I also need it to display the contents of the …

Member Avatar for .:Pudge:.
0
151
Member Avatar for theUserMan

Hello all, First time user on this web forum, I'm having problems with this function I'm building So I need to read in all the data for one movie from a text file that contains several movies text file looks like this 7 8.9 1993 281646 D 195 Schindler's List …

Member Avatar for theUserMan
0
154
Member Avatar for Jaily

Can I somehow use the following code to remove all the elements of a binary tree? [CODE] void BinarySearchTree::remove(int d) { //Locate the element bool found = false; if(isEmpty()) { cout<<" This Tree is empty! "<<endl; return; } tree_node* curr; tree_node* parent; curr = root; while(curr != NULL) { if(curr->data …

Member Avatar for nbaztec
0
2K
Member Avatar for kyros

hello everyone.I have a question. I saw this question in a site and tried to solve this but I have no idea can you help me? Write a recursive function (use no while loops or for loops) that prints all the elements of an array of integers, one per line. …

Member Avatar for Lerner
0
168
Member Avatar for merse

It is possible to exploit the built in floating point arithmetic of the processor without using the standard C++ built in floating point data types?

Member Avatar for mrnutty
-2
94
Member Avatar for KellieD

Hi, Okay, I really need help with this program please... I have to create a program which; Contains a function called sumN() which takes an int n as an argument and returns an int which is the sum of all integers between 1 and n. In the main() it asks …

Member Avatar for KellieD
0
98
Member Avatar for rageplant

I have a problem that I am working on, and it is to find the shortest path on a grid, when you are given a start point, an end point, and a list of obstacles. I managed to set up a grid by using a vector of vectors, but I'm …

Member Avatar for alwaysLearning0
0
236
Member Avatar for ChaosKnight11

Hi. I am working on a visual C++ app and I was wondering if it is possible to use PostgreSQL for database interaction instead of the default SQL Server? I saw a connector for .NET but it's written in C#, will that work for a C++ app also? Or is …

Member Avatar for Stefano Mtangoo
0
324
Member Avatar for knifty09

I haven't needed to use fscanf before, so I'm not very familiar with it... Everything is working fine except that the numbers it inputs are not what's in the file and they are all the same number (-9.255959e+061 to be specific) I know exactly how the files are formatted they …

Member Avatar for jonsca
0
105
Member Avatar for Ultraviolet

I'm trying to use this code to grant the current user full permissions to access System Volume Information: [CODE] //It works when manually written in cmd cacls "E:\System Volume Information" /t /e /g %username%:F //but using this formula to make the command window hidden does not work(doesn't give the permission …

Member Avatar for Ultraviolet
0
160
Member Avatar for keweul

[CODE] #ifndef POLYNOMIAL_H #define POLYNOMIAL_H class Polynomial { public: Polynomial(); Polynomial(int ,int []); ~Polynomial(); const Polynomial operator+(Polynomial& p) const;// addition const Polynomial operator- (Polynomial& p ) const; // subtraction int getExponent(); //void setExponent(); void setCoefficient(); int getCoefficient(); void printPolynomial(); private: int exponent; // exponent int coefficient[ 10 ]; // coefficients …

Member Avatar for cppgangster
0
4K
Member Avatar for cortez716

Okay heres the background on the code. I've written a code that prints a 10x10 array or random numbers. Then prompts the user to pick a number. After user picks a number, the program then tells user the number of times number was found in the array and supossed to …

Member Avatar for vanalex
0
207
Member Avatar for narunaru

Hi, i'm a beginner software program developper ( i don't have advance knowledge on c++!!). I'm trying to make a gettime function where the program displays something like this: Monday October 2, 2009 10:34 am I know that constants needs to be declared, and I need to multiply 60 (number …

Member Avatar for ixmike88
0
90
Member Avatar for smeghead007

ok guys one quick question for you. If im reading a file say formated like so.. 123 d52.55 w52.66 d55.55 d66.66 456 w55.55 d55.55 d66.6 and i want to read the first variable so 123 and match it up with another file. how do i go about reading the rest …

Member Avatar for SgtMe
0
192
Member Avatar for chode1

#include <iostream> #include <fstream> #include <iomanip> #include <string> #include <ctime> using namespace std; void pickword (); int wordlength (); void printout (); void gameplay (); void totalgames (); void replay (); int main() { string guessed=""; string scaffold_top="______"; string scaffold_pole=" |"; string scaffold_bottom="_|_____"; string names[350]; ifstream infile; infile.open("smaller2.txt"); int counter; …

Member Avatar for SgtMe
0
151

The End.