C++ :: Remove Function Not Working?

Jan 24, 2014

Below is my .h file and the code below that is my function that I'm having troubles with. Its suppose to take in a users topic and see if that topic exists, if it does exist then find the keyword, commentcompare will find where that keyword is and delete the comment. However its not deleting anything and its returning temp is NULL.

class comment //adds a comment
{
public:
comment(char * create_comment);

[Code]...

View 3 Replies


ADVERTISEMENT

C++ :: Hash Table Remove Function

Apr 11, 2013

I am working on creating a program using HashTables. This is for homework. This is the first time I am using and creating HashTables, so forgive me in advance as to I don't know entirely what I am doing. The main problem I am having right now is incorporating my remove() function. I can get the code to compile, but when I run test the program out, it crashes. The error that I am receiving is list iterator is not decrementable Here is my hashtable class as well as my remove() function. Also need to incorporate a print method.

class HTable
{
public:
HTable(int size);

[Code]....

View 5 Replies View Related

C++ :: Remove Element From Array By Using Function?

Jun 2, 2013

how i can remove element from array by using function?

View 3 Replies View Related

C/C++ :: How To Remove (Function Should Have A Prototype) Error

May 22, 2013

#include<iostream.h>
#include<conio.h>
int main() {
setcolor(BLUE);
setbkcolor(yellow);
cout<<"the text in blue colour with yelow background";
getch();
return 0;
}  

it keeps returning the same error always in my turbo c++ compiler . What is the correct program for changing background colour and text colour ...

View 1 Replies View Related

C :: WAP To Remove Vowel String Using Pointer And Function

Jan 25, 2013

WAP to remove vowel string using Pointer and Function...

View 6 Replies View Related

C++ :: Binary Search Tree Remove Function

Feb 14, 2014

Im working on a BST remove function. I think I'm on the right track but I'm not sure. From what I understand there are 3 possible cases. A Node with no children, one child, or 2 children(this being the most complex).

void BST::remove(int x) {
TreeNode *n;
TreeNode *v;
n= root;
while(n != NULL && n->key != x){

[Code] ....

View 4 Replies View Related

C :: Mod Function Not Working

Nov 27, 2013

Code:
#include <stdio.h>
int main() {
int m,c;

for(c=0;c<100;c++) {
m = c % 10;
printf("%d ",m);
}
return(0);
}

When I run this code in my compiler, I get the first nine or ten numbers, and then after that it just spells out the letters in my name in different sequences over and over.

View 3 Replies View Related

C++ :: Calling Another Function Within A Function Not Working

Feb 20, 2013

I have two functions bool check_key(string cKey, string eKey) and bool check_digit(char digit1, char digit2), and I have declared both of them globally (is this the right terminology?) right after the "using namespace std;" and right before the "int main(){".

In the first one, I called the second one . But it is giving me the error: "no match for call to `(std::string) (int&)' ".

Code:
bool check_key(string cKey, string eKey) {
if(cKey!="" && eKey=="") return false;
if(cKey=="" && eKey=="") return true;
if(cKey=="" && eKey!="") return true;
if(cKey.length()!= eKey.length()) return false;
bool flag=true;

[Code] ....

View 2 Replies View Related

C :: Recursive Function Not Working

Nov 9, 2013

the functions checks if the word is a palindrome like"level" "madam" etc. but with input "dfdfdfdffdfd" my recursive function fails.

Code:

/* main.c - Created on: Nov 9, 2013 - Author: Kaj P. Madsen*/
#define MAX 100
#include <string.h>
#include <stdio.h>
int checkPalindrome(char checkString[MAX]);
int checkRecPalindrome(char checkString[MAX], int strLgt, int a);
}

[code]....

results from "dfdfdfdffdfd" added some print to see that its the variables a and strLgt not functioning properly

Code:

dfdfdfdffdfd.
The word is not a palindrome(iterative)
strLgt: 11 a: 0
a: d strLgt: dstrLgt: 10 a: 1
a: f strLgt: fstrLgt: 9 a: 2
a: d strLgt: dstrLgt: 8 a: 3
a: f strLgt: fstrLgt: 7 a: 4

The word is palindrome (recursive)

View 4 Replies View Related

C :: Rounding Function Not Working

Oct 12, 2013

Why the roundf function is not successfully rounding my numbers.

Code:
#include <stdio.h>
#include <math.h>
//function declarations
void CelToFah (int ctemp, int ftemp);

[Code]....

it produces a correct number when called, but it is not a rounded number, the roundf((float)cel) does nothing. I get the same number with and without it.

View 6 Replies View Related

C++ :: String Function Isn't Working?

Dec 6, 2014

The function Reverse does seem to work. Its supposed to take the words in a sentence and then reverse them. For example: "This is nice" to "Nice is this." When I type "This is nice" I get " niceniceis nice"

#include <iostream>
#include <string>
using namespace std;

[Code]....

View 1 Replies View Related

C++ :: Function Call Is Not Working

Oct 15, 2013

i think my function call is not working and i dont know how to fix it. Basically i want it to output my getstudent function and once i get the information i want it to output with the displaystudent.

#include <iostream>
#include <string>
using namespace std;
void displayStudent(Student x) {
cout << x.first << ' ' << x.last << endl;
cout << x.id << endl;

[code]....

View 6 Replies View Related

C++ :: Delete Function Not Working?

Oct 9, 2014

making my delete function work. My program does compile but my delete function doesn't work. I haven't finished my last two functions because I am focusing on the delete but how to Sell a title and print the value of all sold titles would be nice as well.

#include <iostream>
#include <cstdlib>
#include <string>

[Code].....

View 2 Replies View Related

C/C++ :: Call To Function To Calculate Fx/f Is Not Working

Apr 23, 2014

I am writing a program where f is the frequency and the x has the values as well. Now I am calculating the mean which is summation fx divided by summation f. I have the two functions working correctly but the getmean function is not working. It suppose to divide fx/f . check the code below

#include <iostream>
using namespace std;
const int SIZE=5;
class statisticalOperator{

[Code]....

View 2 Replies View Related

C :: Concatenate Strings In Array (2D) - Function Not Working Right?

Sep 6, 2013

I have a function that concatenate the strings in an array(2D)

Ex 1: Sean Connery Micheal King James Wood

Result: SeanConnery MichealKing JamesWood ...

The concatenation function working correctly and displays correctly in the function. But if I make another function to display it, it shows this

Ex 2: SeanConnery Sean MichealKing Micheal JamesWood James..

It adds to first name. Why?

Code:
void Concatenation( char dest[200][13] ) {
// loop through and concatenation the strings
for(int i=0;i<200;i+=2) {
myStrCat(dest[i],dest[i+1]); // mystrcat is equalto strcat()

[Code] .....

View 4 Replies View Related

C++ :: Average Calculation Function Not Working As Expected To

Dec 16, 2013

[URL] ....

My calculation function will not work like i wanted it to. It gives me 0 or a crazy number.

this is the function here:
the entire code is on the link:

double calculations(data&avgs) //Calculates the students grade into a final grade
{
int avg1;
int avg2;
int avg3;
int lab1;

[Code] ....

View 12 Replies View Related

C :: Get Binary Number And Change Its Bits - Calling A Function Not Working

Apr 8, 2013

This code gets a binary number and change its bits. I have a problem with the "bits_up" function . Why this function not working?

Code:
#include <stdio.h>
#include <stdlib.h>
int bits_up(uint first,uint last,int *ptr);
int main(void)
{
uint first,last,bitUD;
int InputBinNumber[4],updatedNum[4];

[Code] ....

View 5 Replies View Related

C++ :: Count Function In Program Not Working Properly - Counting Blank Nodes

May 9, 2013

I tested my count funtion. So my count function is not working properly, it should return 5 because 5 words have prefix "tal," but it is giving me 10. It's counting blank nodes.

This is my main.cpp file

int main() {
string word;
cout<<"Enter a word"<<endl;
cin >> word;
string filename;

[Code] .....

View 9 Replies View Related

C++ ::  Class Safe Array Type Print Function Not Working When Called

Oct 22, 2013

I've created a function where you can choose any bounds for an array based list (positive or negative, as long as the first position is smaller than the last position). However for some reason when I call the print() function in my application program it doesn't do anything. My print function is technically correct (I still have work to do on the output) but I can't figure out why it wont show anything at all. Below is my header, implementation, and main program files, along with results from running the program.

Header File:

//safearrayType Header File
class safeArrayType {
public:
void print() const;
void insertAt(int location, const int& insertItem);
safeArrayType(int firstPlace=0, int maxPlace = 100);

[Code] ....

ResultsEnter the first bound of yourlist: -3(this was my input)
Enter the last bound of yourlist: 7(this was my input)

Press any key to continue...

View 1 Replies View Related

C++ :: How To Remove A Substring

Aug 4, 2014

I have a C-based string. trying to remove some sub-string, I got at:

char str[]="alireza tavakkoli";
char* pos = strstr( str, "reza");
for(int j=pos-&str[0];j<pos-&str[0]+strlen("reza");++j)
str[j] = 7;

But I don't like the last line.isn't there a better solution?

View 7 Replies View Related

C :: Remove Spaces From String

Mar 19, 2013

I'm unable to print out or return the inputted string modified.

Code:

//ch11_9.c
//remove_spaces(char* given_string)
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
char* remove_spaces(char *given_string){

[Code]...

View 12 Replies View Related

C :: Two Int Arrays - Remove Duplicates From Second

Apr 3, 2013

Code: /*
generals is the first array. Max 10 elements.
numGenerals is the element count of generals.

genBuff is the second array; it is to be checked/pruned.
genCount is the element count of genBuff.
genBuff will be a max of 171, but be pruned to no more than 10, and no more than the complement of the element count of generals.
*/

[Code] ....

(I do have comments in the actual source, different from above).

I have two int arrays. They hold values from 0 to 170. The first one will never be more than 10. The second will be at most 171, but will be whittled down to at most 10, usually less. 171 is worst case, most users of this particular program will probably be reasonable and not try to add all 171 (max is 10 anyway). The first array is the original array. The second array is a temporary array. Any value in the second array that is also found in the first array, is removed from the second array, since all values in the first one must be unique. After this pruning process, both arrays will collectively contain no more than 10 unique elements; the elements from the second will be added to the first.

So right now I have three nested loops. I figured with the miniscule array sizes it wouldn't be a big deal. I can think of a way to remove one or two of them, but I want to be sure that I'm still writing clean, legible, good-practice code. The first loop walks through the first array. For each element in the first array, there is a second loop to walk through the second array to check for duplicates. If a duplicate is found, the third loop walks through the second array to overwrite the duplicate while preserving the second loop's position (j).

Is this dumb? I know that the big O gets worse and worse the deeper you go with nested loops. Even though the arrays are really tiny, is this still a thing to avoid?

View 5 Replies View Related

C :: Remove Need For ENTER Key To Be Pressed

Jul 5, 2013

The following 2 codes are almost identical, only that the switch statements are slightly different. The 2nd code has the issue of requiring an additional enter key to be pressed when I enter '3' as input to exit the program.

Working code :

Code:

#include <stdio.h>
#include <ctype.h>
#include <string.h>
void clearKeyboardBuffer() {
int ch;
while ((ch = getchar() != '

[code]....

View 7 Replies View Related

C :: Remove Array Element?

Jan 27, 2013

I want to a C program to delete an element from an array which can use both index method & character method
For example

input : "1 222 333 4444"
output:"1 22 333 4444"
if either index = "4" or character ="2" is entered

It should able to read in/accept any input array of varying length, and the position/index or element in array to be deleted...

View 6 Replies View Related

C++ :: Remove Digits In Number

Jul 18, 2013

I know how to remove digits in number from right to left.For example: the number 319. If I do (number /= 10), I get 31.how can I remove digits in number from left to right.For example: the number 319. If I will do something, I will get the number 19.

View 15 Replies View Related

C++ :: Remove 0 At The End Of The Linked List

Sep 22, 2013

I had ...

class List;
List *deletezeroendlist(List* L);
class List {
public:
intdigit;
List*nextDigit;
public:
List():digit(0), nextDigit(NULL){}
List(int d, List *next):digit(d), nextDigit(next){}

I have tried many different ways but it is still not the answer / perform the function List *deletezeroendlist(List* L)

EX

L=12345600 -> L=123456
or L=01203000 -> L=01203

remove the 0 at the end

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved