1,426 Posted Topics

Member Avatar for DS9596

The problem is that `cin.get(response);` is leaving an `'\n'` in the buffer so when you call `cin.get(c);` at the beginning of the loop it pulls in the `'\n'`. Since `'\n'` stops the inner loop it never gets executed and then you are asked to continue again. To fix this you …

Member Avatar for NathanOliver
0
458
Member Avatar for phony

Compare each element entered by the user to the previous input. If the number is smaller then set it to min. Otherwise keep the min you already have. Since you don't know what min should be on the first entry you either need to set min to the first entry …

Member Avatar for NathanOliver
0
400
Member Avatar for cassie_sanford

@Zee Khan - Start a new thread, don't resurrect a 6 year old thread. You should try to see if you can do it first and then if it doesn't work then ask for help with the code you have.

Member Avatar for NathanOliver
0
442
Member Avatar for zandiago

Start a new thread and post the code that you have and the problem it is having.

Member Avatar for NathanOliver
0
9K
Member Avatar for Sarkurd

I have to add that if you have a C++ 11 compiler then you should be using `nullptr`.

Member Avatar for Sarkurd
0
294
Member Avatar for LATCH808
Member Avatar for richieking
0
141
Member Avatar for markdean1989

backslashes should be `\\` since `\` is an escape character. Try: infile.open("C:\\Projects\\C++\\infile.txt"); outfile.open("C:\\Projects\\C++\\outfile.txt");

Member Avatar for markdean1989
0
364
Member Avatar for cambalinho

Is `imgtest` a pointer? I am guessing it is not because of the error : "ambiguous overload for 'operator!=' (operand types are 'image' and 'int')" If a type is not a pointer you should not try to comapre it to `NULL`. `NULL` is just `#define NULL 0` so anywhere you …

Member Avatar for cambalinho
0
289
Member Avatar for shafiqkuidad

Sounds like this is something you should do yourself. If you have code and you are having problems with it then post the code you have and what problem you are having. If it is a compilation error included the error from the compiler and what line it is referring …

Member Avatar for NathanOliver
0
151
Member Avatar for Bilal_9

Go through the string and change each letter to uppercase. You can use [toupper()](http://www.cplusplus.com/reference/cctype/toupper/) to make life easy.

Member Avatar for NathanOliver
0
64
Member Avatar for Hasheeb

Are you having an issue with your code are are you just showing us it? If you are having a problem explain what it is. If you are having compiler errors tell us that the error is and what line it is happening on.

Member Avatar for dbfud1988
0
2K
Member Avatar for bobtherobot

To get a double one of the numbers needs to become a floating point number so the compiler knows to do floating point math. bmi = static_cast<double> (703 * weight / (height*height)); //BMI calculation becomes bmi = 703.0 * weight / (height*height); //BMI calculation As an FYI if none of …

Member Avatar for NathanOliver
0
266
Member Avatar for afra afzal

`main()` needs to be moved from line 105 to line 6. It should also be `int main()`. `main()` should always return an `int`. You also need to get rid of lines 108-110. You should also add a break after case 1.

Member Avatar for tinstaafl
0
261
Member Avatar for DS9596

What happens if you run the code? I can tell you `5%3` is 2 not 1. `%` works as `5 - ((5/3) * 3)` or `a%b = a - ((a/b) * b)`. Line 4 should be 7 based on [order of operations](http://en.cppreference.com/w/cpp/language/operator_precedence).

Member Avatar for YarMak
0
250
Member Avatar for Search_not

Why not use `std::wstring` instead of `std::string`. Then you can call `std::wstring.c_str()` which will give you an `wchar_t*`.

Member Avatar for Search_not
0
905
Member Avatar for glao

You are playing with undefined behavior. You should never go past the end of an array. Just because it worked doesn't mean it will always work. What you actually did was to write data into memory that `p` has no control over. The compiler does not check these conditions for …

Member Avatar for glao
0
109
Member Avatar for aliasadullah
Member Avatar for Lardmeister
-1
177
Member Avatar for afiya abdu

It would only be fair. Unless he wants to pay for the work to be done. I'll offer my services for $250 USD per hour.

Member Avatar for ddanbe
0
129
Member Avatar for ivel

when something is evenly divisible by a number the modulo is 0. 15 / 3 = 5 15 % 3 = 0 Knowing this you can write the following code to see if something is divisble by a number: if(someNUmber % 3 == 0) the number is divisble by 3 …

Member Avatar for NathanOliver
0
293
Member Avatar for Ahmad Imran

`fclose()` is declared as `int fclose ( FILE * stream );`. As you can see it only takes one `FILE*`. So the answer to your question is no.

Member Avatar for NathanOliver
0
100
Member Avatar for Ippolitos

This isn't really a C++ problem. Try uninstalling the program and reinstalling the program that uses EEDE77.ccp

Member Avatar for Ippolitos
0
1K
Member Avatar for Abiy_1
Re: date

There is an entire standard header file full of functions to do this. Check out [ctime](http://www.cplusplus.com/reference/ctime/).

Member Avatar for NathanOliver
0
36
Member Avatar for Praveen_13

You can learn all about this problem [here](https://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream)

Member Avatar for NathanOliver
0
153
Member Avatar for leo_7

And you have done what so far? We do not do your homework for you on this site.

Member Avatar for happygeek
0
150
Member Avatar for markdean1989

Use an if statement and check to see if your files are actually open. You can do that with if(!infile.is_open()) cout << "Input file not opened!"; if(!outfile.is_open()) cout << "Output file not opened!";

Member Avatar for markdean1989
0
521
Member Avatar for Ahmad Imran

Here is a listing of escape codes: \n newline \r carriage return \t tab \v vertical tab \b backspace \f form feed (page feed) \a alert (beep) ' single quote (') \" double quote (") \? question mark (?) \\ backslash (\)

Member Avatar for NathanOliver
0
141
Member Avatar for petrisor.ionel

line 32 should be `int IteratorTablou(int *crt = 0): crt(_crt)` You should also be returning a value from the function since you have an `int` return type. If you don't want to have a return then make the function `void`.

Member Avatar for NathanOliver
0
124
Member Avatar for cambalinho

@cambalinho The reason you are gettting that error is `std::string.c_str()` returns a `char*` to the c-string the string contains. A `char` and a `char*` are not the same thing. If you want just the first character from the c-string then you can use: TableMenuShortCuts[TableMenuShortCuts.size()-1].key=(j.c_str())[0]; // or TableMenuShortCuts[TableMenuShortCuts.size()-1].key=*(j.c_str());

Member Avatar for sneekula
0
343
Member Avatar for senait.kifle.127
Member Avatar for Mubeshier

Do you have graphics.h on your system? From what I remember graphics.h is a very old deprecated header from the good old DOS days. I wouldn't think it would be in GCC 4.x.

Member Avatar for Duoas
0
1K
Member Avatar for Sunil_12
Member Avatar for Sunil_12
0
266
Member Avatar for Luisa_1
Member Avatar for Luisa_1
Member Avatar for rubberman
0
179
Member Avatar for fawadali

Since this is posted in the C++ forum how about: std::cout << "*\n***\n*****\n*******\n*********\n*********\n*******\n*****\n***\n*";

Member Avatar for dbfud1988
0
194
Member Avatar for rose_2

What need to know is how things are [passed by reference or passed by value](http://stackoverflow.com/questions/373419/whats-the-difference-between-passing-by-reference-vs-passing-by-value)

Member Avatar for rose_2
0
256
Member Avatar for it@61@sec

You can change your function to the following to take into account the filename. bool operator() (finfo i, finfo j) { if(i.fsize == j.fsize) return i.filename > j.file return (i.fsize > j.fsize) }

Member Avatar for it@61@sec
0
990
Member Avatar for umairshabbir6822
Member Avatar for NathanOliver
0
116
Member Avatar for Nghia_1

[Here](http://en.wikipedia.org/wiki/Vehicle_routing_problem) is a good wiki that should start you on your path. This is a NP complete level problem which is going to require a lot of work.

Member Avatar for rubberman
0
158
Member Avatar for mR.faVOriTo

line 249-250: `do {` lines 267-274: if(bValid) { for ( i = 0; i < nInterval; i++) { y = (nStart + 1) % 5; viewStudentRecord(c, y); } } while(ch != 'Q' || ch != 'q'); } The closing brace where while is at is actually the closing brace for …

Member Avatar for tinstaafl
0
2K
Member Avatar for nuller
Member Avatar for NathanOliver
0
85
Member Avatar for maria.gretta

So what seams to be your problem. Just posting your homework will get you nowhere. I will offer to do it for $1000 USD that that is a limited time special offer.

Member Avatar for bc230201818
0
211
Member Avatar for kungle

-O0 will give you zero optimization and can't remember where I was told this since it was a few years ago but that will definitely cause your code to be very slow. I would recommend using -Og which is: >Optimize debugging experience. -Og enables optimizations that do not interfere with …

Member Avatar for Maritimo
0
605
Member Avatar for exoruel

Your algorithm is a little wrong. Here is how you can do it (pseudocode): string first, second; // get the data for the string for i = 0 to i < first size - second size if (substring(first[i], first[i+second size]) == second) counter++;

Member Avatar for exoruel
0
370
Member Avatar for Echo89

There is a lot of information here: http://en.wikipedia.org/wiki/Methods_of_computing_square_roots

Member Avatar for rubberman
0
2K
Member Avatar for Fil_1

Herb Sutter has shown that you can use the following to shrink a container down string(str).swap(str); This will create a temporary string object with exactlly what is left in `str`. then it swaps that new smaller string into `str` and puts the bloated one in the temporary. then the temporary …

Member Avatar for NathanOliver
0
936
Member Avatar for deepeshmathuria

What are the errors the compiler is giving you? Al so formating of you code is terrible. Code block should look like either of the following some line of code; if (some condintion) { some line of code; another line of code; if (another condition) { some line of code; …

Member Avatar for Moschops
0
203
Member Avatar for Echo89

I'm still rocking a floppy at work but it is a USB external floppy. The machine I have also has a serial port and that was hard to come by. When will computer manufactures realize that stuff built in the 80's-90's still works great today?

Member Avatar for Moschops
0
176
Member Avatar for samishaikh

getting a runtime error points suggest that you are going out of the bounds of the array. What I wold suggest is that in your get and set methods you put in an if statement that checks to see if you are out of bounds and if you are then …

Member Avatar for chahinez.abdelo.9
0
537
Member Avatar for yaya1234

This post seems a little nonsensical. `"t6"` is not a char but a string. What is the type of arraystr? Why are you storing the answer into int's?

Member Avatar for sepp2k
0
116
Member Avatar for rela

Well you can either use [command line arguments](http://www.cplusplus.com/articles/DEN36Up4/) and code your program to accept and use those or you can just call you program and have the program ask you for what it needs. // example of ussing command line arguments c:\programFolder\program.exe -inputFile input.txt -outputFile output.txt // program output here …

Member Avatar for CodeWarrior14
0
414

The End.