49,761 Topics
| |
would the workings of strlen() be something like this? [code=c++] int strlen(const char * str) { int size = 0; while (!!*str) size++; return size; } [/code] any feedback would be appreciated. also i have learned that !! will convert a value to an actual bool eg. !!104 = 1 | |
i know the following function is not correct, but its suppose to read a text file(which containts the words "hello all") and pass it to a Vector called V1 and then encrypt it and pass the encryption to a second vector called V2 and finally output the result into a … | |
hey does anyone know if i am using the srand() fucntion correctly to randomly choose if a persons letter is X or O? [CODE]#include <iostream> #include <cstdlib> using namespace std; int main() { srand(time(0)); int playerTurn = rand() % 2; char initPname; if (playerTurn == 1) { initPname= 'X'; playerTurn++; … | |
//I am trying to use the reverse function but only get garbage when trying to print s2. How do I properly assign s2 a value in order to print it in main? #include <iostream> #include <string> using namespace std; class ch_stack { public: void reset() { top = EMPTY; } … | |
I hope this doesnt constitute as me asking for answers but I am running a program and at the end I am asked for the program to wait 10 seconds after saying goodbye and prompted back to main menu. I have researched this on google and from some of the … | |
If I where to have a matrix of say: 123 456 789 How would I write a getVal() functions so that row[0]col[0]=1 and so for? | |
[CODE]current = queues[i];[/CODE] This line of code is killing me. I am suppose to be doing a write method for an array based priority queue. However I cant seem to get the first node on the give part of the array. queues is of the Queue class which is a … | |
Hello everyone, Background: I am currently attempting a project for a professor of mine, but I cannot integrate my formula properly into my code. The project calls for a conversion from numbers to words. (I last worked in C++ a year and a half ago, so any words that don't … | |
Trying to learn recursion. Problem asks to use recursion on non-negative number to insert commas. Ex: 20131 as 20,131. My program adds in an extra comma at end. Any help in pushing me in the correct direction to fix this would be appreciated. Tried to use a 'count' to determine … | |
HOMEWORK HELP - Just so i stick by the rules. The second part of my assignment is to create an array object, and love and behold, im having problems passing my small array into the function. Bellow is my code of what i have done so far, the solution seems … | |
write a c program that computes the grade of a student using the formula. grade=40%major exam+30% ave of two long exams + 30%ave of 3 short quizzes.. Display the average of two long exams,average of 3 short quizzes and the grade of the student. Display also a message whether the … | |
Ok i am writing a program with Arrays and could use a little help. I have to build a two dimensional array with data from a file. The file has date that first is two numbers followed by a list of charterers. So the fist line of data is 2 … | |
Can someone help me with this code.. I have a function which is InsertNode() it is use for inserting a new node after the index in the double link list.. For example I want to add a node of value 6.0 after position 3 This is the code i write..but … | |
[CODE]#include <iostream.h> float salary (int, float); int main() { int n,h,i; float r,GS; cout <<"Enter number of employees: "; cin >> n; for (i=0;i<n;i++) { cout << "\n Hours= \t"; cin >>h; cout<< "\n Rate= \t"; cin >> r; GS=salary(h,r); cout << "\nSalary=\t"<<GS << "\n"; cout << "Rate=\t"<<r<<"\n\n"; } return … | |
this my cpp file : [CODE]//****************************************************** // Chapter 15, Programming Challenge 7 * // PersonData and CustomerData classes * //****************************************************** #include <iostream> #include "PersonData.h" #include "CustomerData.h" using namespace std; // Function prototypes void displayPerson(PersonData); void displayCustomer(CustomerData); int main() { // Create a PersonData object and pass arguments // to the … | |
Hello all I wanted to make a text editor in C or C++. I wanted to make it for learning purpose only and also so that I can modify it further according to my personal use. I am good at C++ but do not have much experience at writing large … | |
Hello People, I've joined this forum and I need some help with sorting a vector of structures. Here is the problem: I have the following structure> struct student { char name[20]; char lastname[20]; int points; } class[10]; Can you help me figuring out a void function that will have a … | |
I have a doubt regarding avl trees.i got a part of this code from the internet.But this code was mde to use with integer input.But what i need to do is to insert strings which are alphanumeric.I am using strcmp() for insertion..but the output differs from the actual one.. Can … | |
I want as said in 'cout' to input 10 or more letters in this statement but when i try to run it when I enter more then 10 letters i get error that says:: Run-Time Check Failure #2 - Stack around the variable 's' was corrupted" so is there any … | |
say int a[]; int &p=a; int *q=a; what is the difference b/w p and q ?? Is it like q can retrieve the value of the address which it is pointing to where p cant do that ... or is there something else also..... | |
A couple things to mention: 1.) This program uses system("PAUSE"); in the main function, if you are not using Windows, you might have to pull it. 2.) There are a couple lines in there that are not needed, I'm just using them to test the size of the array. My … | |
hi every one........... i'm new in this forum and need ur help please.... i want to write a programme using c++ code, programme that find the optimal parenthesization of a matrix-chain product, then perform the optimal matrix -chain multiply 4 a sequence of matrices, but the user should enter the … | |
please help me what kind of programmed i must defend for my thesis... just a simple program that i can possibly past this coming February 23... haizt... hazzel... | |
Hi. I have two homeworks which is to make a Fibonacci series using iteration and recursion. Im finished with iteration. I got the right code for recursion its just that, I don't know how to show the numbers for the fibonacci, it only shows the answer. Here's the code: [CODE]#include … | |
Hi :) I am certain of when to use static_cast, but often I can get satisfactory results by writing the target type in a parenthesis. For example: [CODE]void* data = somePointer; SomeClass* new_ptr = static_cast<SomeClass*>(data);[/CODE] seems to work when replaced with [CODE]void* data = somePointer; SomeClass* new_ptr = (SomeClass*) data;[/CODE] … | |
Here is my code: [CODE] /** * @file qsort.cpp * * @date 11/2/07 * * This program implements the non recursive version of quicksort */ #include<iostream> using namespace std; /** * Swaps two items * * @pre x and y are the items being swapped * @post Contents of actual … | |
Hi all, I want to know how much memory does my umap allocates in ram. I have the following definitions std::tr1::unordered_map<string, long> umap; umap h1; i do some insertions and at the end i want to know how much memory my umap allocates in ram. How can i find this? … | |
Hi I like to develop application what is connected to database using C++.Please tell me some tutorials. Essential for me is connecting to databease but i like to learn and using buttons ,drops down menus ,erors handling ect.With this stuff tutorials should have 20 pages. | |
How do I get rid of the zero digit in this program? this is a factorial problem and I have to show the numbers to be multiplied before arriving to the answer. The problem is, in the iteration process, the number zero will show. How do I get rid of … | |
We are using a singly linked list with head pointer to implement Stack ADT. The stack top is maintained at the [B]end of the linked list,[/B] i.e. stack top is the last item. Discuss whether this is a good design in term of time efficiency: In a stack of N-items, … |
The End.