Posts
 
Reputation
Joined
Last Seen
Ranked #786
Strength to Increase Rep
+6
Strength to Decrease Rep
-1
100% Quality Score
Upvotes Received
5
Posts with Upvotes
5
Upvoting Members
5
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
5 Commented Posts
~22.7K People Reached
Favorite Forums
Favorite Tags
c++ x 90

49 Posted Topics

Member Avatar for Tommybb

[QUOTE=Tommybb;759674] .... Are there any good online sources you all would recommend for a beginner? Thannks, Tom [/QUOTE] The following site is good, but of course won't cover much. I personally learn only from the internet, and make programs for fun and complex calculations. Whenever I want to do something …

Member Avatar for parul26sha
0
1K
Member Avatar for thilinam

Binary operations are operations between two variables (like a+b, a-b, a^b, a/b etc.). Unary operations are operations on one variable (a++, a-- ...)

Member Avatar for pirbhat.ariya
0
239
Member Avatar for clutchkiller

Look at this link: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1031963460&id=1043284385[/url] The last method is probably what you're looking for.

Member Avatar for Narue
0
2K
Member Avatar for jiten_raulo

In case you like math, you can try the following site: [url]http://projecteuler.net[/url]

Member Avatar for jiten_raulo
0
141
Member Avatar for esesili

Two things: First, you forgot to add the first number to the total. Second, with [icode]while(!source_file.eof())[/icode] you run through the last line twice. Therefore, instead of 10+20+40+10+12 = 92 you get 20+40+10+12+12 = 94

Member Avatar for mrnutty
0
131
Member Avatar for kelechi96

Look at the code here: [code] if (pos [color="red"]![/color]= -1) { goto badsearch; } [/code] I think you meant: [code] if (pos [color="red"]=[/color]= -1) { goto badsearch; } [/code] Another thing is that string::search() returns string::npos if the search function does not find what it was told to find, and …

Member Avatar for kelechi96
0
169
Member Avatar for FREEZX

I don't understand - why do you have the numbers input as 'int'? Why don't you have the numbers input directly into a string and then use the operator [] to move through the digits and count values? I think it could be much more efficient - just run a …

Member Avatar for tux4life
0
1K
Member Avatar for archiphile

In addition to the above posts: 1) The user has no chance to input the second number. Better add [icode]cin>>dsecondnumber;[/icode] after the user is told to input the second number. 2) In your [icode]case[/icode] statements the output is always [code]cout<< " The Answer is:"<< dfirstnumber << (operator) << dsecondnumber << …

Member Avatar for RayvenHawk
0
174
Member Avatar for soulbee1

Why not use the built-in [URL="http://cplusplus.com/reference/algorithm/random_shuffle/"]random shuffle()[/URL] function from the header [icode]<algorithm>[/icode]?

Member Avatar for nucleon
0
731
Member Avatar for wuzj1988

Look at your while loop: you closed it before it started: [icode]while(ordnum != 99999);[/icode]. Just remove the semicolon right after the [icode]while(ordnum != 99999)[/icode] and everything should be fine ;)

Member Avatar for wuzj1988
0
158
Member Avatar for SmokyMo

Change this line: [icode]cout<<fly.freeSeat;[/icode] to this: [icode]cout<<fly.freeSeat[color="red"]()[/color];[/icode] Remember that [icode]freeSeat[/icode] is a function ;). Edit: I guess Narue was faster :)

Member Avatar for SmokyMo
0
136
Member Avatar for badboizEnt

Add [icode]Password="";[/icode] before [code=c++] while(encrypt != 13) { Password.push_back(encrypt); cout << '*'; encrypt = _getch(); } [/code] That's because when the user enters a wrong password you keep [icode]Password[/icode] with the wrong password and just add characters to it. You need to empty it before.

Member Avatar for badboizEnt
0
162
Member Avatar for Clockowl
Member Avatar for rudolph2004

What about a linked list? Or alternatively, you could store all the class instances in an array with as many elements as the the user inputs, and to check which instance has the student's ID run a loop through all the indexes. An example to make it all clearer: [code=c++] …

Member Avatar for unbeatable0
0
129
Member Avatar for queensrose

The function is expecting an int[] (array/pointer) type and you pass an int, instead you should write the function as: [icode]void bookInfo(char[14],char[51],char[31],char[31],char[11],int,double,double);[/icode] It would also be better if you used strings from the <string> header instead of arrays of [icode]char[/icode]s.

Member Avatar for unbeatable0
0
137
Member Avatar for iammfa

[QUOTE=iammfa;844199]Hi all, what is the bug in the following code: [code=c++] #include <iostream> #include <string> int main() { string str = "Hello World!" cout << str << endl; cout << float x = 5.0f * str << endl; int 65Num = 65; cout << "65Num = " << 65Num << …

Member Avatar for stephen.id
0
140
Member Avatar for hurbano

[code=c++]outputFile<<"Name: "<<Pname<<" "<<outputFile<<"Date:"<<TDate<<endl;[/code] You output what outputFile returns. This line should be [code=c++]outputFile<<"Name: "<<Pname<<" "<<"Date:"<<TDate<<endl;[/code]

Member Avatar for hurbano
0
168
Member Avatar for hurbano

I'm guessing it's because of the getline() function. When I replace the [code=c++] if(AWUTD=='y'||AWUTD=='Y') { cout<<"Please Specify:"<<endl; getline (cin, AWUTDspecification); } [/code] with [code=c++] if(AWUTD=='y'||AWUTD=='Y') { cout<<"Please Specify:"<<endl; cin>>AWUTDspecification; } [/code] it works better. I suggest that you read the following ReadMe thread: [URL="http://www.daniweb.com/forums/thread90228.html"] How do I flush the input …

Member Avatar for tux4life
0
307
Member Avatar for arunciblesp00n

[QUOTE=vmanes;761217]Where do you get an 8 byte long int? It's 4 bytes everywhere I've seen.[/QUOTE] A [icode]long long int[/icode] (signed/unsigned) is 8 bytes. [icode]cout<<sizeof(long long)[/icode]

Member Avatar for ArkM
0
5K
Member Avatar for ademsaykin

Please use code tags. Otherwise it'll be hard for us to tell you on which lines your mistakes are.

Member Avatar for ademsaykin
0
296
Member Avatar for Icebone1000

You'll have to re-write everything. Just make a new file, read the file you want, and write the lines to the new file, with the changes you want. Afterwards, erase the old file and rename the new file to the old file's name. There's something similar (erasing a line from …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Cpp_Addict

What do you mean? Do you want the blocks to appear in lines, like that?: [code] ****** ****** ****** ****** ****** * * * * * * * * * * * * * * * * * * * * ****** ****** ****** ****** ****** [/code] If you do, …

Member Avatar for unbeatable0
0
121
Member Avatar for Agni

It doesn't matter that 'i' doesn't exist when main() ends and the thread is using it, simply because when main() ends the whole program shuts down, including the threads.

Member Avatar for Salem
0
192
Member Avatar for new2c++
Re: game

The computer doesn't recognize when a cell is occupied because you didn't tell it to. You're making a check only on board[5][x]. You should use a loop to check which is the the highest place available and just then test it.

Member Avatar for MosaicFuneral
0
103
Member Avatar for tomtetlaw

A much clearer method would be [icode]rand()%x[/icode], where x is the number you want. For example, [icode]rand()%7[/icode] will return a random number between 0 and 6, and the code [icode]rand()%7+1[/icode] will return a value between 1 and 7. If you want the numbers to be as random as possible, add …

Member Avatar for Narue
0
316
Member Avatar for Shinedevil

[url]http://www.daniweb.com/forums/post31214.html[/url] This link should help you. It teached me well how to use ifstream objects.

Member Avatar for daviddoria
0
139
Member Avatar for dextrew

We won't do your homework. You should provide us some code so we can know you've at least tried. [url]http://www.daniweb.com/forums/announcement8-2.html[/url]

Member Avatar for William Hemsworth
0
195
Member Avatar for rkumaram

Why should a constructor fail? When you declare a constructor, all the instances of the class will have to use it, or variations of it (if you declare some).

Member Avatar for rkumaram
0
170
Member Avatar for ninja_gs

[code=c++] for(x=0;x<s.length();x++) { if((s[x]>'9' || s[x]<'0') && s[x]!='.') { input_type=IS_STRING; break; cout<<" Its an integer "; } else if(s[x]=='.') { if(!DotReached) DotReached= true; else { input_type=IS_STRING; cout<<"ITs a Float"; break; } } } [/code] Line 6: How do you want the program to output "It's an integer" when there's a …

Member Avatar for ninja_gs
0
120
Member Avatar for 30Caliber

I think it would be much smarter to use the built-in function from <algorithm> header file -- random_shuffle(): Run a loop and insert to the array all the numbers between 1 and 10,000, then call random_shuffle() to shuffle them. An example code: [code=c++] #include<iostream> #include<fstream> #include<algorithm> using namespace std; int …

Member Avatar for 30Caliber
1
2K
Member Avatar for jeevsmyd

[QUOTE=jeevsmyd;756974]sorry I dont understand you.. i have that code in my programme..! :)[/QUOTE] Functions should be declared outside the main() function. Example: [code=c++] long int factorial(long int); int main(void) { // blah blah blah } // main() ends /*now you can declare another function. Can also be before main(), but …

Member Avatar for StuXYZ
0
120
Member Avatar for singhraghav

I think the following snippet is more efficient (using the ideas of the above code by Chris): [code=c++] #include<iostream> #include<cctype> #include<string> using namespace std; int main(void) { int InputValue=0,x; string Input; cout<<"Input a string to check its value:\n"; getline(cin,Input); for(x=0;x<Input.length();x++) { if(isalpha(Input[x])) { InputValue+=toupper(Input[x])-'A'+1; cout<<toupper(Input[x])-'A'+1<<"+"; } } cout<<"\b="<<InputValue<<"\n"; system("pause"); return …

Member Avatar for Freaky_Chris
0
111
Member Avatar for singhraghav

Switching from capital letter to small letter and vise versa is easy: The letter is capital if it's between 'A' and 'Z' (inclusive)(ASCII symbols' values are in order) and the letter is small letter if it's between 'a' and 'z' (inclusive). So, to change a small letter to a capital, …

Member Avatar for unbeatable0
0
291
Member Avatar for meistrizy

So, you actually want to round up when (the number) mod 1000 is equal or greater than 500, and down if (the number) mod 1000 is less than 500. An example to how you could write it: [code=c++] #include<iostream> using namespace std; int main(void) { int x; cout<<"Enter a number …

Member Avatar for meistrizy
0
169
Member Avatar for singhraghav

This thread may help you: [url]http://www.daniweb.com/forums/thread161801.html[/url]

Member Avatar for BeyondTheEye
0
116
Member Avatar for singhraghav

Why bother with the whole word when you only need the first letter ('m' or 'f')? [code=c++] if(s[0]=='m' || s[0]=='M') // do what you want for male else // do what you want for female [/code]

Member Avatar for unbeatable0
0
102
Member Avatar for ninja_gs

Input to a string, then call a function to check whether it the input string has only digits (and '.', '+' and '-' as first only). If it really has only digits, it's a number. If it has a dot, it's a floating-point number, else it's an integer. If you …

Member Avatar for som shekhar
0
193
Member Avatar for clutchkiller

I also had a big problem understanding pointers, but it's not that hard: pointers are just like any other variables when you use the asterisk (*) before them - which leads to the value in the address they hold. They're useful because, just how serkansendur said, you can save computer …

Member Avatar for ArkM
0
84
Member Avatar for m18

[icode]private: double rad[b][color="red"]ui[/color][/b]s;[/icode] I think you swapped these two letters

Member Avatar for m18
0
147
Member Avatar for Se7Olutionyg

" This program models a simple calculator which can add, subtract,multiply,divide, power" I don't see any power operation in the program. If you meant to the ^ operator, it doesn't do power (at least in c++). It's an operator which works on bits. For power you need to implement a …

Member Avatar for unbeatable0
0
89
Member Avatar for unbeatable0

Just wanted to know... is there any variable in C++ that can hold larger numbers than [icode]unsigned long long int[/icode], or is it the largest variable? Thanks in advance :P

Member Avatar for dmanw100
0
129
Member Avatar for Benbon86

[QUOTE=Benbon86;710639]I actually found this site while trying to fix my awful coding so no, I did not have a chance to read the site's stickies and for that, I apologize. I've been trying to figure this out for the past three hours and I know this is pretty simple but …

Member Avatar for Benbon86
0
687
Member Avatar for unbeatable0

Is there a way to #define something as a #warning? I tried using the following code, but it gives me an error: 'warning' undeclared (first use this function) This is the part of code where the error appears: [code=c++] #define something #warning This is not a standard function! int main(void) …

Member Avatar for Salem
0
213
Member Avatar for Ellisande
Member Avatar for Narue
0
96
Member Avatar for Traicey

[QUOTE=Traicey;707204]I dont know what would I do without u, thanx man but can u provide me with a sample code so I can just replace[/QUOTE] [url]http://www.daniweb.com/code/snippet777.html[/url]

Member Avatar for unbeatable0
0
118
Member Avatar for jeevsmyd

You can add a time limit by adding something like: [code]clock_t StartTyping;[/code] and every time the game runs do: [code]StartTyping=clock()[/code] Then, before checking if the answer is correct, check if it was on time. Example: [code=c++] if((clock()-StartTyping)/CLOCK_PER_SEC>/*number of seconds here*/) { cout<<"It took you too long!"<<endl; cin.get(); exit(0); } else …

Member Avatar for Sci@phy
0
653
Member Avatar for jetdreamer

I'd suggest that you use the [icode]clock() [/icode] function. Examply of use: [code=c++] #include <ctime> #include <iostream> #define SECONDS number of seconds here.. using namespace std; int main(void) { int guess; cin>>guess; if(clock()>SECONDS*CLOCKS_PER_SEC) return 0; return 0; } [/code] Note: clock() returns the number of milliseconds passed since the program …

Member Avatar for unbeatable0
0
209
Member Avatar for anny**

Remove the [icode]long[/icode] before the [icode]float[/icode] and change [icode]%lf[/icode] to [icode]%f[/icode]. Then it'll work. Also, it'd be clearer if you'd intialize [icode]j[/icode] when declaring it, and not some lines after it.

Member Avatar for sidatra79
0
262
Member Avatar for unbeatable0

Hey there, I'm trying to use the SetSuspendState() function to hibernate the computer, but I have no idea what parameters I should send to it. The prototype is "BOOLEAN WINAPI SetSuspendState(BOOLEAN, BOOLEAN, BOOLEAN);" Since I'm a somewhat beginner in c++ programming, I don't really have an idea what BOOLEAN means …

Member Avatar for dougy83
0
564

The End.