I was wondering if anyone can give me an idea on how i can modify this function to check for duplicates, if it contains a duplicate, since duplicates are not aloowed, output a message. Any help would greatly be appreciated. [code]template<class Type> void orderedLinkedListType<Type>::insertNode(const Type& newItem) { nodeType<Type> *current; //pointer to traverse the list nodeType<Type> *trailCurrent; //pointer just before current nodeType<Type> *newNode; //pointer to create a node bool found; newNode = new nodeType<Type>; //create the node assert(newNode != NULL); newNode->info = newItem; //store newitem in the node newNode->link = NULL; //set the link field of the node //to NULL if(first … |
+0 forum
9 | ||

i know how to find prime numbers of several numbers, does anyone know hoew to find a prime sumber of a single number inputed by the ser using the following function and printing out if the number is prime int mai()//asks for input { int num; cout << "enter number:"; cin >> num; call IsPrime; cout if prime or not } bool IsPrime(int n) // precondition: n >= 0 // postcondition: returns true if n is prime, else returns false // returns false if precondition is violated { if (n < 2) // 1 and 0 aren't prime { return … |
+0 forum
3 | ||

Can Any one reccomend a good book in c++ on Game programming? |
+0 forum
7 | ||

Does anyone know how to create circular linked list whose links are numbered from 1 to n specified by the user? |
+0 forum
10 | ||

Here is the formula i'm suppose to use: i'm suppose to to write a complete program with a function using two parameters to calculate: x(!)^n, where x(!)^n = x!! ... ! use BigInts For the calculations ----- n times this wis what I have, i don't think it's right, if you can tell me what is wrong, and correct it, i'd greatly appreciate it. #include <iostream> #include <cmath> #include "bigint.h" //uses a class that is specified in my header file //along with bigint.cpp using namespace std; BigInt Factorial(int num); int main() { int num; int power; int current = 0; … |
+0 forum
7 | ||

i'm trying to write a program that takes two numbers from the user prints out the sequence between the 2 numbers and then outputs wthe longest sequence for example if the user inputed 8 and 10 it should out put 8 4 2 1 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 10 5 16 8 4 2 1 i got the code as follows that does it for 1 number #include <iostream> using namespace std; int f(int n); int main() { int first; cout << "Enter First … |
+0 forum
5 | ||

i was wondering how to strip off digits one by one and store them into an array so i can sort them. For example if the user entered 7216. take the 7 stor into cell one, take 2 store it cell 3 ettc and then sort it so it looks like this 1267 and then output it back as a whole number instead of segments in other words tak 1 2 6 7 and concatenate it so it looks like 1267 whic is one thosand two hundred sixty seven. i'm not sure if i need a loop or not. i … |
+0 forum
12 | ||

Can anyone give me an idea how to convert an int or decimal number into hexadecimal? I know how to do it for binary by dividing by 2 and using the modulus % operator, but how do you take into account a b c d e f if the integer is greater than 9? any ideas would greatly be appreciated. |
+0 forum
7 | ||

Can Anyone explain to me what defines a symmetrical matrix and what is i'm looking for that mkes a matrix symmetrical, any help on this subject would greatly be appreciated. it would help me understand, so i can write the boolean function to test if a matrix is symmetrical or not. |
+0 forum
1 | ||

How do you count charcters in C++? for example if the user inputs 1234 the output would be 4 and -1234 the output would be 5. also if a user enters a numbers until a 0 is entered it outputs the nunmber of positive numbers entered and the number of negative numbers entered. i know how to terminate the lop i'm not sure how to count the number of positive numbers and then the number of negative numbers entered. Any help on this would greatly be appreciated, i might be looking to much in to it, it's always the case … |
+0 forum
1 | ||

Does anyone know how to get a loop to display the numbers across the screen in groups of 10 usin a while loop? for example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 etc..... |
+0 forum
1 |

The End.