49,761 Topics
| |
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; … | |
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 = … | |
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()) { … | |
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 … | |
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"; … | |
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 ); … | |
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; … | |
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 … | |
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 … | |
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] | |
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 … | |
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; … | |
Anyone knows what is the best library for bluetooth in c++? | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. … | |
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? | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … | |
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 … | |
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 … | |
#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; … |
The End.