2,712 Posted Topics

Member Avatar for C_Dannehl
Member Avatar for Salem

Usually my password, is something like this , xxxxxxYZZZZ, where x is a letter, Y is a punctuation, and Z is a number.

Member Avatar for PedroStephano
0
707
Member Avatar for miteigi-san

clock() returns the time in mili seconds, CLOCKS_PER_SEC is the conversion factor from the value returned by clock() into seconds. [code]while (clock() < stopwait) {} [/code] That code waits until the value returned by clock() is greater than stopwait, meaning, it waits X amount of milliseconds, where x is stopwait.

Member Avatar for mrnutty
1
621
Member Avatar for joshuabraham

For powers of two all you have to do is use the shifter, which is very fast and is probably almost constants for the usual powers of 2. For ordinary numbers, its probably the O(exp), where exp is the exponent. For example, base^exp, to calculate that it would probably take …

Member Avatar for joshuabraham
0
122
Member Avatar for Violet_82

Maybe an easier class will help see below : [code] class Integer{ private: int myInt; //an integer variable public: Integer(){ myInt = 0; } //a constructor Integer(const int initValue){ myInt = initValue; } //another constructor void setMyInt(int value){ myInt = value; } //set myInt to some value int getMyInt(){ return …

Member Avatar for Violet_82
0
148
Member Avatar for n.utiu

There is also [URL="http://www.eclipse.org/downloads/"]Eclipse[/URL].

Member Avatar for abdelhakeem
0
91
Member Avatar for Jfunch

The easy way is to use the setw method or the cout.width method. Take a look : [code] void printChars(const char whatToPrint, const size_t howMany){ for(int i = 0; i < howMany; ++i) cout << whatToPrint; } void printTri(const size_t height){ for(int i = 0; i < height; ++i){ std::cout.width(height-i); …

Member Avatar for mrnutty
0
461
Member Avatar for angel6969

Lets take test cases an see where that leads us. <input> 4 2 <output> 4/2 We need the output to show it in the reduced term so 4/2 reduces to 2/1 which reduces to 2. For the test case above name some things you notice about 4/2 ?

Member Avatar for angel6969
0
275
Member Avatar for Ana_Developer
Member Avatar for RehabReda

Do you know what this means : [code] typedef unsigned int uInt //? [/code] Do you know what a class is? Then all this [code] typedef basic_string <char> string[/code] is, is a typedef for a template class called basic_string; Its the same as this : [code] typedef int INT [/code] …

Member Avatar for mrnutty
0
99
Member Avatar for iammfa

>>short shortEgyPop = 80000000 [CODE]for_each(seconds : 1 minute) printBig("OVERFLOW");[/CODE] [CODE] //From MSDN //"Microsoft Visual C++ recognizes the types shown in the table below." Type Name Bytes Other Names Range of Values short 2 short int, signed short int short -32,768 to 32,767 unsigned short 2 unsigned short int 0 to …

Member Avatar for mrnutty
0
90
Member Avatar for magdalin

[QUOTE=magdalin;1119667]i want the time complexity for transpose of a matrix i want the time complexity for heap sort i want time complexity for merge sort[/QUOTE] And I want : 1) 1 million dollars 2) 2 billion dollars 3) 3 trillion dollars I got an idea, how about you help me …

Member Avatar for mrnutty
-4
53
Member Avatar for ppotter3

Haven't looked at it in details, but I see that your search function is a linear search. Make it a binary search since the array should be sorted already. You will see that using the linear search you will have to do about on average N/2, where N is the …

Member Avatar for ppotter3
0
1K
Member Avatar for rsaska

Pause it. [code] if (lower_first > upper_first) { printf("Lower-bound IP address > upper-bound IP address"); cin.get(); exit(0); } [/code]

Member Avatar for rsaska
0
109
Member Avatar for panagos

This is wrong : [code]T min(vector<T> a())[/code] Try to guess which part. Edit : Hint look at the error

Member Avatar for dusktreader
0
201
Member Avatar for SpyrosMet

No its not valid. And thats because of the operator precedence. Here is an example that shows how to make it valid : [code] class Int{ public : int var; Int() { var = 0; } Int(const int& i) { var = i; } }; int main(){ Int * num …

Member Avatar for mrnutty
0
102
Member Avatar for philipbas

A class : [code] class Test{}; [/code] A pointer : [code] int *p = 0; [/code] Combine them and you get a "class pointer" : [code] class Test{}; Test *p = 0; [/code]

Member Avatar for dusktreader
-2
81
Member Avatar for mikabark

You need to make it a reference. In fact do something like this : [code] void write(const string& str, std::ostream& out = cout){ out << str << endl; } [/code] Now you can call the code like this : [code] write("Hello"); // and prints to screen write("Hello",myout); //and write to …

Member Avatar for mrnutty
0
85
Member Avatar for Zay

You might be looking for constructor with default value : [code] struct Int{ int var; Int(const int& initValue = 0) { var = initValue; } }; [/code] Therefore when you do this : [code] Int num = Int(); //num = 0 for now Int num2 = Int(2); // num = …

Member Avatar for mrnutty
0
100
Member Avatar for falcon60

When using list, you have to use iterators. When using vectors you have a choice of using index or iterators, usually you should pick the index version( which means use the operator [] ). The STL uses iterators to generalize their functions. For example using std::sort(..), it takes in a …

Member Avatar for Salem
0
73
Member Avatar for hket89

Oh when you say pair you mean in an 2d array like structure? Like so : [code] Random generate= new Random(); int[][] Array2d = new int[4][4]; for (int row = 0; row < Array2d.length; row++){ for (int col = 0; col < Array2d[row].length; col++){ Array2d[row][col] = generate.nextInt(8) + 1; // …

Member Avatar for hket89
0
257
Member Avatar for dude1

[QUOTE=dude1;1117241]i have a numeric updown that goes from 0-99 and it works but i want to make it continuous so if i hit the down when its at 0 it goes to 99 and when its on 99 and i hit up it goes to zero anyone know the code …

Member Avatar for jonsca
0
159
Member Avatar for isralruval

Here are some hints : For the divelement function you need to see if a number is multiple by 5? One way to do this is to use the mod operator. The mod operator returns the remainder. Here is an example on how to use it : [code] //returns true …

Member Avatar for mrnutty
0
103
Member Avatar for Salem

[QUOTE=Salem;1107281]Only this time, it wasn't. My reply to [URL="http://www.daniweb.com/forums/thread254052.html"]this thread[/URL] is there in the singular. But I also got a "This forum requires that you wait 15 seconds between posts. Please try again in 1 seconds." I rather suspect had it timed out differently, it would have been a double …

Member Avatar for Nick Evan
0
234
Member Avatar for khevz09

combine your even and odd in one loop : [code] for(int num = start; num != end; ++num){ if(num % 2 == 0) cout << num << " is even\n"; else cout << num << "is odd\n"; } [/code]

Member Avatar for dusktreader
-1
108
Member Avatar for makan007

I am not sure whats your problem? Do you want to generate random character, if so then use something like this : [code] //returns a "random" letter char getRandomChar(){ return rand() % ('z' - 'a') + 'a' } [/code]

Member Avatar for dusktreader
0
227
Member Avatar for vin1

Your code is really hard to look at. But from your question : "cant determine the winner" I figure that the winner checker is not working. There are 2 things you can do. Option1 : Make a hard-coded function that checks for winner Option2 : create a for loop to …

Member Avatar for mrnutty
0
142
Member Avatar for serkan sendur

>>[B] i am not dating but once you are into something real, you dont feel like you need females any more..[/B] Sounds more If a hot girl hit on me, then I would be dating, but since I do not have the courage to hit on hot girls, I found …

Member Avatar for ~s.o.s~
-4
230
Member Avatar for vidit_X

I have commented on your code with code comments , see below : [code] #include<iostream> using namespace std; [COLOR="red"]// A TEMPLATE CLASS WILL BE BETTER[/COLOR] class matrix[COLOR="Red"] //USUALLY A CLASS NAME SHOULD START WITH A CAPITAL LETTER( from convention)[/COLOR] { [COLOR="Red"] //is the user able to change these ? if …

Member Avatar for vidit_X
0
266
Member Avatar for rwill357

This code causes a memory leak. [code] IntSLLNode *tmp; tmp = (IntSLLNode*)malloc(sizeof(IntSLLNode)); tmp = head; [/code] So does this code : [code] IntSLLNode *oldTmp; oldTmp = (IntSLLNode*)malloc(sizeof(IntSLLNode)); oldTmp = tmp; [/code]

Member Avatar for Lerner
0
395
Member Avatar for Izarian
Member Avatar for sexyzebra19

Why do you need pointers? Now just do something with the gauss function, like so : [code] double gauss(fun f, double a, double b, int n){ return ( (*f)(a) + (*f)(b) ) * n; } [/code] The above is just a random example.

Member Avatar for sexyzebra19
0
96
Member Avatar for zero_crack87

[QUOTE=zero_crack87;1112977]i want diz for my final project...tq[/QUOTE] Really? I mean really ? I am utterly speechless. Really, you have got to be kidding?

Member Avatar for Nick Evan
-4
106
Member Avatar for trigg0n

*sigh*, Another post without code-tags. If only I had $1000 for every post without code-tags. You should be using arrays to get the input first, instead of the ugly hard-coding, and use std::strings like so : [code] const int MAX_INPUT = 10; string userInputs[MAX_INPUT] = { string(""); } for (pos …

Member Avatar for mrnutty
0
127
Member Avatar for kriszy0515

[QUOTE=kriszy0515;1112500]hello??? can you give me a complete program about a fraction calculator???[/QUOTE] I'll give it to you for 1 zillion gazillion quintillion dollars?

Member Avatar for hag++
-3
74
Member Avatar for blueman:-0

When posting code, the format should look something like this( see below), if it isn't then make it until it is. This is not only help us read better, but it will also help you get better comments. [code] //notice not .h #include <iostream> #include <cmath> using namespace std; int …

Member Avatar for mrnutty
0
184
Member Avatar for Nexadus
Re: Lab

All you have to do is read the file but insert the elements you get into its correct place. Is this enough of a hint?

Member Avatar for Nexadus
0
113
Member Avatar for sidra 100

[QUOTE=GrimJack;1105422]I'm a jerk[/QUOTE] Then here is your theme [URL="http://www.youtube.com/watch?v=qv9VKKXwVxU&feature=related"] song.[/URL] I am the worlds champion at [URL="http://en.wikipedia.org/wiki/Human_hunting"] this [/URL] sport.

Member Avatar for zortec
0
142
Member Avatar for sidra 100

They are the member variables. For example : [code] class Person{ private: //attributes int health; int power; public: Person(){ ... }; } [/code] So a health and strength is an attribute of a person.

Member Avatar for sidra 100
0
81
Member Avatar for cwarn23

Is this what you need : [code] #include <iostream> #include <string> #include <sstream> using namespace std; typedef size_t Type; string toHex(const Type& number){ stringstream stream; stream << hex << number; return stream.str(); } int main(int argc, char *argv[]) { string num = toHex(15); cout << num << endl; return 0; …

Member Avatar for Poincarre
0
411
Member Avatar for vaultdweller123

Damn as soon as I graduate college, I will be dead. I guess I should drop out.

Member Avatar for ankush.mukherje
0
158
Member Avatar for schoolboy2010

First declare a function like so : [code] int readInt(std::ifstream& readFile){ int res = 0; //error checking if you want readFile >> res; return res; } [/code] Then you can make another function that loops that function like so : [code] void readIntArray(std::ifstream& readFile, int *Array, const int Size){ int …

Member Avatar for schoolboy2010
0
87
Member Avatar for kenji

>> I'm trying to copy a value in a vector to a string. The vector is also of string type, I'm trying to copy through the iterator So you are trying to copy the strings inside a vector into an array ? or into another vector ? or into another …

Member Avatar for jonsca
0
137
Member Avatar for jigglywiggly

[QUOTE=jonsca;1109569]Unfortunately you don't show us the add() method itself. Does it make sure that the last pointer is not null? Does it create a head at the beginning if there's not one?[/QUOTE] He shows it at the beginning : [code] void LinkedList::add(string imissjava) { temp = (node*)malloc(sizeof(node)); temp->data = imissjava; …

Member Avatar for jigglywiggly
0
222
Member Avatar for Chetan_

Thats not going to be very easy for a beginner. What part do you need help with? Also is the function for (2) correct? Is that column's law.

Member Avatar for Chetan_
2
112
Member Avatar for FatimaRizwan

compare your program to this( not compiled ) [code] #include <fstream> #include <iostream> #include <string> using namespace std; int main() { ifstream file("Ahoo.txt"); if(!file) return -1; string wordToFind; cout <<" Enter a word to find in the file Ahoo.txt\n"; cin >> wordToFind; string word; bool isFound = false; while( file …

Member Avatar for jonsca
0
447
Member Avatar for makan007

Your code is asking for trouble. You need to seed the random generator, put this code inside the main where it will be called only once, : [code] srand( time(0) ); [/code]

Member Avatar for kvprajapati
0
102
Member Avatar for rkulp

>>srand(unsigned(time(NULL))); You only need to do this once. Put that statement inside main, and just call it once. It only needs to be called once.

Member Avatar for hag++
0
247
Member Avatar for jonnybgood

Usually C++ test are useless. A test just shows that you know definition( in a sense). It does not really show how well you program. Instead of looking for a test, how about you program a big project, with big being subjective. Learn a new skill. Do you know anything …

Member Avatar for Narue
0
118
Member Avatar for gamerchick

You mean something like this : [code] bool find2D(int Array[][COL],const int key, const int MaxRow){ bool isFound = false; for(int row = 0; row != MaxRow; ++row){ if( findArray(Array[row], COL, key){ isFound = true; break; } } return isFound; } [/code]

Member Avatar for abdelhakeem
0
129

The End.