49,761 Topics

Member Avatar for
Member Avatar for NathanOliver

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

Member Avatar for Ancient Dragon
0
145
Member Avatar for isralruval

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 …

Member Avatar for VernonDozier
0
67
Member Avatar for corby

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++; …

Member Avatar for corby
0
137
Member Avatar for crozbme

//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; } …

Member Avatar for crozbme
0
76
Member Avatar for jimJohnson

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 …

Member Avatar for necrolin
0
152
Member Avatar for webdragon89

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?

Member Avatar for webdragon89
0
97
Member Avatar for pinsickle

[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 …

Member Avatar for pinsickle
0
135
Member Avatar for CSStudent728

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 …

Member Avatar for WaltP
0
121
Member Avatar for DuffManLight

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 …

Member Avatar for WaltP
0
1K
Member Avatar for Suicidal_tool

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 …

Member Avatar for mitrmkar
0
171
Member Avatar for amia

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 …

Member Avatar for restrictment
-1
89
Member Avatar for Jeff_5_7

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 …

Member Avatar for NathanOliver
0
153
Member Avatar for wale89

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 …

Member Avatar for mrnutty
0
97
Member Avatar for frag

[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 …

Member Avatar for vmanes
0
91
Member Avatar for asa88

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 …

Member Avatar for mrnutty
0
834
Member Avatar for akssps011

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 …

Member Avatar for WaltP
0
172
Member Avatar for nike_jj4

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 …

Member Avatar for WaltP
0
104
Member Avatar for gudali

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 …

0
53
Member Avatar for fplgenius

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 …

Member Avatar for NathanOliver
0
86
Member Avatar for Nicris

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.....

Member Avatar for NathanOliver
0
135
Member Avatar for return_Milk

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 …

Member Avatar for return_Milk
2
136
Member Avatar for tulip6

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 …

Member Avatar for TECHNICAL GIRL
0
283
Member Avatar for porchia

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...

Member Avatar for WaltP
-2
59
Member Avatar for superdhebz

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 …

Member Avatar for WaltP
0
96
Member Avatar for Excizted

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] …

Member Avatar for Excizted
0
139
Member Avatar for JaksLax

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 …

Member Avatar for Nick Evan
0
84
Member Avatar for alenD

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? …

Member Avatar for alenD
0
112
Member Avatar for delhiris

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.

Member Avatar for Ancient Dragon
0
69
Member Avatar for superdhebz

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 …

Member Avatar for superdhebz
0
752
Member Avatar for cool1_best1

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, …

Member Avatar for mitrmkar
0
153

The End.