537 Posted Topics

Member Avatar for Nandomo

instead of using getline(), you should continue your use of the >> extraction operator. unlike getline(), the extraction operator depends on 'white space' delimiters. the way you are doing it now, you are trying to do is to store the entire first line into bevName :s

Member Avatar for Clinton Portis
0
111
Member Avatar for jmcorpse
Member Avatar for Clinton Portis
0
2K
Member Avatar for djhog

1. you should #include<algorithm> 2. you create 'string line;' but then never assign anything to it.. 3. so when you call search(line.begin(), line.end(), search.begin(), search.end(), nocase_compare), arguments #1 and #2 will return iterators to a string of nothing. for more information: [url]http://www.cplusplus.com/reference/algorithm/search/[/url]

Member Avatar for djhog
0
181
Member Avatar for mrar85

When you say you need the "range of marks", are you asking for the the highest and lowest score for each exam?

Member Avatar for mrar85
0
1K
Member Avatar for manofhouse

I believe your problems are here: [CODE] //line #78 if (currentPlayer ='X') //and line #81 else (currentPlayer = 'O');[/CODE] You are making a common mistake when it comes to boolean comparison.. take a minute, think about it, and tell us what ye' come up with. [I]In fact this error is …

Member Avatar for macobex
0
142
Member Avatar for Martje

If ye' are trying to display an ascii escape character as text, simply add an extra \ backslash before each escape character.

Member Avatar for Martje
0
58
Member Avatar for nickcolb

I suspect a '\n' newline character is being left in the input buffer when the user presses the ENTER key. Try using cin.ignore() right after line #24 to force the leftover newline character to be disregarded by your program.

Member Avatar for Clinton Portis
0
93
Member Avatar for KLane

one thing that i notice is that you got a couple of smiley faces in your code.

Member Avatar for mrnutty
0
118
Member Avatar for YahRioO

1. you never initilize the 'count' variable.. it could be anything. (you should also do the same for 'average' as good practice) 2. you should decrement the count variable by 1 before using it in calculations in order to account for an extra loop iteration in the case of a …

Member Avatar for Clinton Portis
0
277
Member Avatar for Glapsides

[quote]Just take my code above and edit to create what I asked.[/quote] would you like a side of fries with your order..

Member Avatar for Glapsides
-4
117
Member Avatar for ntaraaki

your search algorithm will probably look something like this: [CODE] bool found = false; int index = 0; cout << "Enter random zip code: "; cin >> zip_code; for(int i=0; i < max_number_of_cities; i++) { if(zip_code == mystruct[i].zip) { found = true; index = i; break; } } if(!found) { …

Member Avatar for ntaraaki
0
900
Member Avatar for blackxswil

you never #include<iostream> or #include<string> or using namespace std; you asked if line #3 is correct, it is correct; however, will continue to throw errors until you include the string library.

Member Avatar for jonsca
0
121
Member Avatar for sha11e
Member Avatar for rlhh

just my two cents.. I'm not sure if you can derive your main() function from Deck.. (i've never done it this way) this would be new to me: int Deck::main() I would segregate your program into the standard three sections: .h header file, .cpp main driver, and .cpp function definitions …

Member Avatar for Clinton Portis
0
90
Member Avatar for wickedflo

I believe this version of your program will at least compile: [CODE] #include<iostream> using namespace std; int A[5]; int ctr = 0; int main() { ctr = 5; while(ctr < 5); { cin >> A[ctr]; ctr++; } cout << A[5]; ctr = 5; do { cout << A[ctr]; ctr++; }while(ctr …

Member Avatar for alaa sam
0
182
Member Avatar for frogboy77

[code] string stuff[10]; stuff[2] = "infinity"; for(int i=0; i<10; i++) { cout << stuff[i] << endl; }[/code]

Member Avatar for frogboy77
0
75
Member Avatar for steve_Student

Although I don't fully understand the assignment, I will attempt to throw some code your way to help get the gears spinnin' inside ye' head. based on your current coding style, i would suggest simple if/else logic: [code] //all calls will be at least E1.50 full_cost = 1.5; //adjust call …

Member Avatar for steve_Student
0
187
Member Avatar for maverick405

For most assignments of this nature, most go with storing user input into a cstring.. then use a loop to display the contents of the string in reverse order. Simple. Straight-forward.

Member Avatar for Rootz
0
154
Member Avatar for viperman224

[code] //Preprocessor Directives #include<iostream> #include<string> #include<cstdlib> #include<cctype> #include<ctime> using namespace std; //Function Prototypes void SeedRandom(); void PrintHeader(); void PlayOneMatch(int&, int&, int&, int&, int&); int GetPlayerChoice(); int DrawNum(int); void PrintMove(int, int, int&, int&); void WonAGame(char, int&, int&, int&); void PrintFinalResults(int, int, int, int); void Reset(int&, int&, int&, int&, int&, int&, int&); …

Member Avatar for nrfae91
1
831
Member Avatar for Shaabangbang

one simple strategy, would be to pass the char array into your function as a reference.. therefore any manipulations you perform on the char array will affect it directly in memory. algorithmically, reversing the array is simple. create a new dynamic temporary char array of equal length. copy first element …

Member Avatar for rajnish.singh
0
238
Member Avatar for srinath33

you would either have to create a lookup table or use some other kind of construct (like switch/case)... there are no standard library functions to perform the string to number conversion. for large numbers, you would have to tokenize the string and create a number for each string individually.

Member Avatar for soulcandra44
-1
104
Member Avatar for atch

Here, you are attempting to assign a 'Nunu' object to another 'Nunu' object: [code] p[0] [B][COLOR="Red"]=[/COLOR][/B] a; [COLOR="Green"]//"Error 2 error C2582: 'operator =' function is unavailable"[/COLOR] [/code] Assignment among primitive data types, such as int, float, char, double, etc. is handled by the compiler with relative ease. But what happens …

Member Avatar for atch
-1
289
Member Avatar for jigglymig1

couple things: You are using cstring library functions, without explicitly including the <cstring> header. If it works, hey that's fine. Just letting you know. By putting your array counter at the beginning, you'll always skip over element[0]... I think this is why you are reading the same thing over and …

Member Avatar for sdsda
0
166
Member Avatar for Kushal Thakkar

the only time i can think of using friend functions is for operator overloading.. the rest of the time they should be avoided because they violate OOP data encapsulation.

Member Avatar for Dave Sinkula
0
2K
Member Avatar for timbomo

You need to refine your question before we go all out w/ a bunch of code to give you what may or may not be the correct answer. You unclear in some aspects of your question; for example, you state that you require an 'odd number' input from the user, …

Member Avatar for timbomo
0
297
Member Avatar for XinJiki

You may need something like this: [CODE] bool is_vowel(char& test) { switch(test) { case 'a': case 'e': case 'i': case 'o': case 'u': return true; default : return false; } } [/CODE]

Member Avatar for Ikejae
0
1K
Member Avatar for Coder2009

[quote]May I know use of Method returning a pointer in C++, please?[/quote] What you are saying resembles english and seems quite insightful, so I will offer you this: [CODE] #include<iostream> int* get_address(int&); int main() { int number = 0; std::cout << "Enter a number: "; std::cin >> number; std::cout << …

Member Avatar for Stefano Mtangoo
0
112
Member Avatar for prietysharma121

[quote] This project will require you to develop three C functions: [/quote] You are asking for C help in a C++ forum. You deserved to be weeded out of the natural order of the human species. I should do your assignment in c++ and let you turn it in.

Member Avatar for WaltP
-2
143
Member Avatar for BlinkOnly

[quote]but then new value that is to be inserted has to be after the current_index and the function i have now places it before i have no idea how to make that change [/quote] [CODE] data[current_index+1] = entry; [/CODE]

Member Avatar for WaltP
0
161
Member Avatar for ne0_komodo

Line #12: Initialize 'c' to 9 instead of 10. Line #32: Initilize 'g' to 9 instead of 10.

Member Avatar for ne0_komodo
0
195
Member Avatar for ELBUF

[quote]"vector subscript out of range"[/quote] Just based on that piece of information alone, I bet you are attempting to access a vector element that is larger than vector.size() [CODE] vector<int> v; v.push_back(1); v.push_back(2); v.push_back(3); //No bueno... only elements 0,1, and 2 are currently populated: cout << v[3]; //Access out of …

Member Avatar for ELBUF
0
2K
Member Avatar for DARK_BYTE

As stated by thomas_naveen, you have a classic eof() problem which will need to be remedied in order for your program to work. [quote] I can't understand why it says its out of range when the pos and length I supplied is valid.[/quote] The position of your first white space …

Member Avatar for Clinton Portis
0
110
Member Avatar for SearchDS

If the network printer is selected as the default device, why not just print normally? Printing (as far as I know using win32 api, which I know you don't want to use) involves the evokation of a standard dialogue box in which the use gets to choose the printing device …

Member Avatar for SearchDS
0
2K
Member Avatar for corby

Here is a freebee for ye': [quote] c) create a date constructor that reads the system date using the standard library functions of the <ctime> header and sets the Date members[/quote] [CODE] class Date { public: //Default constructor Date(); private: //Date members struct tm* timeinfo; time_t rawtime; int day; int …

Member Avatar for corby
0
159
Member Avatar for Der_sed

In your example: (5 + 6(3+2) - 2(8*2) +1) Moving from left-to-right, in order to find a valid parenthesized pair, you have to find any condition where a ')' is found after traversing the most recent '(' From left-to-right, anytime multiple '(' are detected, the previous '(' position should be …

Member Avatar for WaltP
0
87
Member Avatar for yznk

[quote]Your program should prompt the user to enter the number of rows and columns in the 2-d grid.[/quote] since you will have the user define the dimensions of your 2d array, you should use a dynamic 2d array: [CODE] int rows = 0; int cols = 0; cout << "Enter …

Member Avatar for jonsca
0
110
Member Avatar for sblass92

At first glance, your stuff looks good... Have you tried #include<iostream> ??

Member Avatar for sblass92
0
181
Member Avatar for mikabark
Member Avatar for em-kay

[LIST] [*]create 2 objects of type 'ifstream' [*]open the two files [*]read in the desired stuff to a container of your choice (usually string objects or vectors) [*]compare the two strings [/LIST] [CODE] string word1, word2; ifstream infile1, infile2; infile1.open("doc1.txt"); infile2.open("doc2.txt"); word1 << infile1; word2 << infile2; if(word1 == word2) …

Member Avatar for Clinton Portis
-4
91
Member Avatar for vbx_wx
Member Avatar for nola_Coder

Although I'm not familiar with Allegro, I am almost certain your game uses a single bitblt() (or "blit()" in Allegro I think) to constantly update the screen.. you'll need to learn how to "double buffer" your screen in order to gain that fluid 'non-flickering' update that ye' desire. Although [URL="http://www.winprog.org/tutorial/animation.html"]this[/URL] …

Member Avatar for nola_Coder
0
174
Member Avatar for StaticX

[CODE] #include iostream using namespace std; int funcReturn(int& index); int main() { for(int i=0; i<3; i++) { cout << funcReturn(i); } return 0; } int funReturn(int& index) { int a[3] = {33, 44, 55}; return a[index]; }[/CODE]

Member Avatar for StaticX
0
83
Member Avatar for XinJiki

[url]http://www.cplusplus.com/reference/string/string/find_first_of/[/url] [CODE] bool is_single_vowel(string word) { //All words contain at least 1 vowel; find it: size_t found = word.find_first_of("aeiouAEIOU"); //Handle Special Case: If no vowel was detected, word must be using single 'y' as a vowel: if(found == string::npos) return true; //Attempt to find any occurance of a second vowel …

Member Avatar for XinJiki
0
247
Member Avatar for dude1

try this: [CODE] string filename; cin >> filename; filename += ".dat"; outFile.open(filename.c_str()); [/CODE]

Member Avatar for dude1
0
98
Member Avatar for return_Milk

Here is an in-depth discussion I googled concerning the dangers of using sizeof(array)/sizeof(arraytype) in order to get current length of an array: [url]http://www.gamedev.net/community/forums/topic.asp?topic_id=345898[/url] [U]Some alternatives to consider[/U]: [LIST] [*]Dedicate a 'size' variable to hold number of entries made into an array. [*]Use null-terminated c-strings; get array length using strlen(). [*]Use …

Member Avatar for return_Milk
2
139
Member Avatar for clutchkiller

Winsock is very popular, easy to use, and is a very good skill to have on the ol' resume. Companies will love you.

Member Avatar for clutchkiller
0
80
Member Avatar for james_bond007

[quote]The problems I'm having now are that the user is only allowed to input a number of sticks to remove once[/quote] I believe this problem may be due to an incorrect (and easily fixable) test condition in line #32. [quote] Also, the computer is not generating a number 1 through …

Member Avatar for WaltP
0
2K
Member Avatar for ace8957

It seems to me that making a function call to determine who the current player is in a game of tic-tac-toe is overkill. It is safe to assume that there will always be two players. It is also safe to assume that if player 1 went, then it will be …

Member Avatar for ace8957
0
3K
Member Avatar for PDB1982

Your 'function-local' variable named TotalMPG we be created and thusly destroyed with every call of the MPG() function. Try creating a class variable that will retain the odometer reading.

Member Avatar for PDB1982
0
94
Member Avatar for Dyed Purple

[U]Useful tips[/U]: you can consolidate lines 13 through 33, and eliminate lines 35 through 44 by doing this: [CODE] // Initializing the eight choices. int iChoice1 = (rand() % 8) + 1; int iChoice2 = (rand() % 8) + 1; int iChoice3 = (rand() % 8) + 1; int iChoice4 …

Member Avatar for Dyed Purple
0
131

The End.