406 Posted Topics

Member Avatar for program900

What first person has said is right about the wrapping but the example given is wrong as it quits the loop on every input 0 or 1(at least according to gcc 4.3). the error is in the line: [code=c++]char quit = false;[/code] You cannot use a character variable to hold …

Member Avatar for WaltP
0
282
Member Avatar for shashanderson
Member Avatar for Jalwes

[B]Definitely no need of looping required.Its a simple four step procedure.[/B] [B]1 )[/B] Read the entire line into the character array say str. [B]2 )[/B] Check if string length of str is greater than 22 or not. [B]3 )[/B] If no then [icode]cout << str ;[/icode]. [B]4 )[/B] If yes …

Member Avatar for csurfer
0
261
Member Avatar for Saadulla
Member Avatar for Web_Sailor

Never done it before ? Very good try it now !!! Only then you will learn... Well in C you would do something like : [code=c++] FILE *f; char str[100],*str1="file",*str2=".txt"; //You have count and file<count> is the file you want to open sprintf(str,"%s%d%s",str1,count,str2); f=fopen(str,"rw+"); //Go on with your writing work …

Member Avatar for csurfer
0
230
Member Avatar for program900
Member Avatar for vmanes
-2
98
Member Avatar for Web_Sailor

There is nothing C++ in this code apart from "using namespace std","cout","bool". You aren't using the isnum function at all as its not used in any decision statements even when it returns true and false. Your isnum function itself id flawed. [QUOTE] if(!isdigit(*str)) cout << "Invalid format" << endl; [COLOR="Red"] …

Member Avatar for Web_Sailor
0
238
Member Avatar for Ponomous

You are using integers to store the factorial of a number and obviously 13! 14! 15! will go out of integer range. It definitely overflows and that is the reason you are getting erroneous outputs. try changing the variables to long int or double and you will get the desired …

Member Avatar for Ponomous
0
145
Member Avatar for yuha

[B]@sparksterz[/B] : No you should not use system("pause") to view the output.It has been discussed here a lot number of times. You can use cin.get() instead and it too will work in the same way. [B]@yuha[/B] : Not one there are several things wrong with this code. [B]1) [/B]Usage of …

Member Avatar for csurfer
0
150
Member Avatar for rasheed1982

Its no coding secret or something but a simple formula kind of thing here it is : For[B][U] two[/U][/B] numbers: [B]max( a , b ) = ( a + b + abs( a - b ) ) / 2[/B] For[B] [U]three[/U][/B] numbers it is: [B]max( a , b , c …

Member Avatar for csurfer
0
132
Member Avatar for Neeraj Ranjan

Ya Sure... Our [B]Assignment Delivery Boy[/B] will come over to your house in another 30 minutes and deliver you the assignment along with the free things which we have offered.Please pay him the amount in cash.Good Day !!!

Member Avatar for csurfer
-3
58
Member Avatar for PDB1982

Waltp and Campbel are right in their concepts but you can still decrease the numbers from which you divide. If the number you need to check is "num" then divide num with 2 and every odd number form 3 upto [ ( int ) sqrt ( num ) + 1 …

Member Avatar for JasonHippy
0
99
Member Avatar for program900

You can take the player class as : [code=c++] class player{ private: string name; int goals_taken; // Keeps count of goals taken int shots_taken; // Keeps count of shots taken int num_streaks; // Keeps count of streaks int num_slumps; // Keeps count of slumps // Keeps count of matches continuous …

Member Avatar for csurfer
0
125
Member Avatar for wanted08

They have mentioned everything so clearly... Use if else or if else ladder to find the ranges in which the given temperature falls and print accordingly...

Member Avatar for Tom Gunn
1
504
Member Avatar for claire89

Whenever you define a string as [code=c++] char str[]="Hello\0MIster\0HowAre You?"; printf("%s",str); [/code] Every time the compiler stops outputing the characters of the string to the output console once it encounters a '\0' character.So even if you put '\0' character in place of ' ' character this won't do any good. …

Member Avatar for csurfer
0
91
Member Avatar for hopeful man

First thing I don't see the purpose of this program as to what it does or is intended to do and apart from it this isn't a psuedocode,this is a C++ code itself other than some erroneous brackets which you can obviously correct by finding a matching pair of brackets …

Member Avatar for Phil++
0
94
Member Avatar for Web_Sailor

Too many problems in your code as I see : [code=c++] string str[0]; int i=0; while(!myFile.eof()) { getline(myFile, str[i], '\n'); vec.push_back(i); } [/code] [B]line 1 :[/B] string str[0] will result in some unexpected value and not the string you want it to hold so change it to [icode]string str;[/icode] but …

Member Avatar for Web_Sailor
0
139
Member Avatar for jhanthem

First of all your code here is incomplete and doesn't serve the purpose until further alterations. Second if you are sure of the three columns present then instead of ">>" getline with specific modifications to fetch the columns separately and store it in different arrays and then calculate their average.

Member Avatar for csurfer
0
147
Member Avatar for maricor

Thanks for posting your assignment/homework for us to work on.... But there is one tiny bit of problem... [B]1)[/B][COLOR="Red"]This isn't the JAVA forum.[/COLOR] [B]2)[/B][COLOR="Red"][B]We never do others homework we just help them to do it on their own.[/B][/COLOR] ACTUALLY TWO....

Member Avatar for csurfer
-3
177
Member Avatar for smi ensi

Just use srand() and rand() commands for more information and how to use them do research on them.

Member Avatar for csurfer
0
57
Member Avatar for babaijeet_123

Please put in the code and mention the area in which you are facing troubles and then ask us... In this way we can help you better...

Member Avatar for csurfer
0
86
Member Avatar for unsure
Member Avatar for Phil++

[B][U]Backing up what niek_e said :[/U][/B] You have used [icode]c[i].GetName()[/icode] in your for loop, you can use c[i].<function name> only if the classes are declared as Customer c[3] or something else you should use the functions as c1.<function>(); c2.<function>(); c3.<function>(); separately as c1.function(); is completely different from c[1].function(); Ok and …

Member Avatar for Nick Evan
0
93
Member Avatar for killerqb
Member Avatar for csurfer
0
76
Member Avatar for Damirz

Whenever you initialise an array partially,the un-initialised part of the array are initialised to zero's automatically.Thats the only thing which happens and as per my knowledge there is no such symbol which would function as you suggested. For it there are two ways, one is you initialising every block value …

Member Avatar for mrnutty
0
270
Member Avatar for geoffy0404

Here are your Errors... [B]Err 1:[/B] Line 67 : [code=c++]scanf("%d", operation2);[/code] It should be [code=c++]scanf("%c", &operation2);[/code] [B]Err 2:[/B] Your macros are completely useless in this case.Even though you can change them to correct the mistake I would suggest an alternate way. [code=c++] scanf("%c", operation2); /* uss a switch case structure …

Member Avatar for Aia
0
128
Member Avatar for nikhil91

Here's your second fastest reply........zoooooooooom..... here it comes... [B] Try it your self[/B]... and post your code here with the problems you are facing then we will be more than happy to help...

Member Avatar for matome
-4
74
Member Avatar for kaylalail

[B]Make use of code tags else no one would even care to look at your code.If you use them it would look like this.[/B] For more information look here [URL="http://www.daniweb.com/forums/misc-explaincode.html"]link[/URL] [code=c++] #include <stdio.h> int input_number(); int main(void) { int numbers[100]; int counter; int sum; int number_elements; printf("The number of elements …

Member Avatar for csurfer
0
85
Member Avatar for saisrk

Your question is very vague... Firstly Identify the type of image file you want to open...Then upon it you need to know that how many bits represent a pixel in that format then your work is very easy. Just pick that many number of bytes and match it with the …

Member Avatar for csurfer
0
49
Member Avatar for Kandeep

Hey this is a C question and you have posted it in a C++ forum. If I am not wrong then you don't want to accept numbers 5 5.5 -5.5 -5 and similar... So you can do this : [code=c++] double rem; rem=fmod(l,5.0); if(rem > 0) printf("Not an error"); else …

Member Avatar for csurfer
0
126
Member Avatar for srivastavarupal
Member Avatar for K0ns3rv
-3
115
Member Avatar for bigskinny

I wan to say two things : [B]1[/B]) [COLOR="Red"]Read the forum rules...And let the thread head specify the topic rather than "Oh please help me.." or "Do my homework for free you dumbo's..." [/COLOR] [B]2)[/B]The question is quite clear try something and then come back. Even the looping information is …

Member Avatar for redburn
0
119
Member Avatar for ramsdellcp

Hey you are posting every problem related to this hangman here at daniweb.Try something on your own.You'll learn a lot. And indent the code properly so that its easy to read... [code=c++] void Hangman::blankSpaces() { cout << "Your word to guess: "; int k,i,flag,p; for (k=0; k<strsz; k++) { flag=0; …

Member Avatar for csurfer
-1
151
Member Avatar for alvalany

This is a very generic question which can only be solved by you depending on your interests. C and C++ help you a lot in system side programming. Java helps you by providing a lot of utilities for application development. Python is a very powerful language which will be the …

Member Avatar for inspiron630
0
109
Member Avatar for ayan2587

Make use of the standard functions given to you,without using that you'll never be able to exploit C to its full potential. You can do this: 1) take the hex number as the input into a character array without the prefix "0x" or "0X" as : [code=c++] char arr[10]; cout<<"Enter …

Member Avatar for ayan2587
0
331
Member Avatar for ramsdellcp

Your code has probelms in function Hangman::blankspaces(). In it you are matching every character of the chosen character with the last guessed character and printing _ or the character for the whole word every time. thats the reason it is showing only the last selected character's place values if any. …

Member Avatar for ramsdellcp
-1
138
Member Avatar for robgeek

Why use a for loop and looping through every character when you have predefined functions for that...??? You are reading the inputs form a text file right,just do this : [code=c++] ifstream file; file.open(<your filename>); char str1[10],str2[10]; file.getline(str1,256,'+'); file.getline(str2,256,'\n'); [/code] Now you have the two values you wanted in str2 …

Member Avatar for rbv
0
107
Member Avatar for kn336a

[B]What Ancient Dragon has suggested is a wonderful suggestion[/b] try to implement it but it [b]is completely inconsiderate with the problem in your code...[/B] In your code : [code=c++] for (int i = MAX - 1; i >= 0; i--) cout << output[i] << endl; //Compiling error if (i % …

Member Avatar for kn336a
1
108
Member Avatar for C++ Beginner

[quote]cin >> sa; if (sa == NC) NC = "North carolina"; else if (sa == SC) SC = "South Carolina"; cout << "The State Abbreviation you entered stands for " << sa << endl; [/quote] Error lies here.You take sa as the input string and then you even match it …

Member Avatar for Grn Xtrm
-1
153
Member Avatar for realmayo

Well I am not able to get your problem exactly but from what I have got I think you can write a friend function which can read those arrays and write it conveniently to the place you want so that you have all the array values which is as good …

Member Avatar for realmayo
-1
99
Member Avatar for mybluehair

You are talking about a text file access through C++ and you should know that for it there is no concept of line,its just a stream of characters and the compiler knows that it should print the characters following '\n' character in the next line. Using this '\n' as a …

Member Avatar for csurfer
-1
141
Member Avatar for redreed

Ya I too feel this is TC that you are working on.So I would suggest this... [B]1)[/B] You can always play with the co-ordinates when working on TC, like usage of gotoxy( x , y ) To move to a particular part of the screen and then print the stuff …

Member Avatar for redreed
0
286
Member Avatar for 4101

Hey tux that was the assignment given by4101 to you. Do it sincerely...You'll learn a lot ;)

Member Avatar for siddhant3s
0
95
Member Avatar for aliaks

It must mean that [ICODE]quizMaster.isCorrectAnswer(answer)[/ICODE] is always returning 0 .Just check in that particular function for solving the problem. Its quite straight forward right.

Member Avatar for aliaks
0
99
Member Avatar for 23.12.2012

[B][U]Little corrections to both the posts given above with some information:[/U][/B] [B]@23.12.2012:[/B] Here [ICODE]s1+=8;[/ICODE] doesn't really help because ASCII value of 8 is [icode]'\b'[/icode] character the backspace character.And by executing the above statement with earlier string s1 which was "Hello World! I am" we get "Hello World! I am\b" as …

Member Avatar for 23.12.2012
1
214
Member Avatar for Ola1

Well here's a starter for you : Let the class be something like this ... [code=c++] class stack{ int arr[50]; //To create a stack of size 50 int top=-1; //Initial value for the variable holding the top position in the stack; public: int push(int x); //Function which takes x as …

Member Avatar for NathanOliver
0
119
Member Avatar for ss2602

[QUOTE=Ancient Dragon;925177]Looks ok to me. The only problem I see is that >> operator will not allow the file name to contain spaces. [B]You need to use getlin() if you want spaces[/B]. Why do you think the code you posted does not work?[/QUOTE] Thats getline() what [B]Ancient Dragon[/B] wanted to …

Member Avatar for tux4life
0
107
Member Avatar for boyjim32

Well we will help you for sure.Here are a set of good books from which you can learn.[URL="http://www.daniweb.com/forums/thread70096.html"]<USEFUL BOOKS>[/URL]. Read all this write a program and then if you have problems come back with your code we will do more than just helping you.Till then enjoy your studies.You wont get …

Member Avatar for tux4life
-1
250
Member Avatar for msteele

The thing you are forgetting is that the concept of lines appear only in case of display to the terminal or in general just the display.While storing there is nothing called a separate line,it is just signified by the '\n' character which tells the display program to start printing in …

Member Avatar for Ancient Dragon
0
178
Member Avatar for ichie06

[QUOTE=jephthah;923987]i think these posts ought to be instantly deleted by moderators, along with a copy of a standard explanation auto-delivered to the poster's email. I can see why Narue has all but left daniweb ... because it's [I]this[/I] kind of non-stop crap just makes me want to flame the hell …

Member Avatar for tux4life
0
109

The End.