Problem with floating variables

Pages: 12
Nov 17, 2019 at 7:55pm
Hi Repeater, Andy.
Nice joke :)) in the car park hahaha.

your warning about including even <iostream> disappointing me, that means i should or must know what every header file and namespace exactly do? and to know how to call or use its classes and functions without including it in my code file !! it is too much effort and details !
i think these libraries has been created or invented to help not to making troubles.
anyway it seems it will not be easy to learn C++ but i hope to find you guys to help me :)

@Andy, sure i want to learn step by step, it is not logic to learn every thing one time from the beginning.
@Andy regarding to the software i use is V.S 6 i also tried my code not your code on codeblocks software it gave me error too !! whilst the code is working on v.s 6 !!so i uninstalled codeblocks to avoid confusion.

this is the error
error C2039: 'tolower' : is not a member of 'std'
Error executing cl.exe.

primnewtecnique.exe - 1 error(s), 0 warning(s)
line 65

thanks a lot for this fantastic conversation and for your help, i really appreciate your help
best regards
semsemdiver
Nov 17, 2019 at 8:02pm
Hi Andy.
i think it should be written like that

} while /*(std::tolower*/(again == 'y'); it works now

thanks
semsemdiver
Nov 17, 2019 at 9:45pm
it is a new technique to me but i will figure it out
I think the two things I used that weren't in your original code are boolean variables (type bool) and the break statement.

Type bool takes on two values: true and false.
The break statement exits the nearest enclosing while(){}, for(){}, do/while() or switch() statement.

As for breaking into programming, learn a couple of different languages. Read other people's code to learn new ways to do things. Take a course on algorithms and data structures.
Nov 17, 2019 at 10:04pm
Hello semsemdiver,

My apologies I believe I missed telling that std::tolower() and std::toupper() need the header file "<cctype>". Although it is the first line of code. I am not sure what happened to cause this error unless you missed copying that line.

The error message:
'tolower' : is not a member of 'std'
is the first indication that the header file is missing. It is saying that it can not find anything, i.e., the prototype, that matches its use.

You tend to see the same thing when you use "std::string" and forget the header file. Also with "std::string"s when you forget the header file a "cout" statement will produce an error message:

C2679 binary '<<': no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)


Once you get use to the error messages they are a great help.

The line while (std::tolower(again) == 'y'); does work with the proper header file.

You may not have covered the header file "<cctype>" in class yet, but in the future, near future, you will find it very useful. Along with the header file "<iomanip" which works with "<iostream>".

I am not sure what year VS 6 came out, but you might want to consider updating to the VS 2017 Community version. The IDE does have the ability to detect errors before you compile to give you a chance to fix them. Just a thought.


your warning about including even <iostream> disappointing me, that means i should or must know what every header file and namespace exactly do? and to know how to call or use its classes and functions without including it in my code file !! it is too much effort and details !


I may be getting ahead of what you know, but I am speaking about the day when you learn about creating your own header files. Include files like "iostream" and "string" should always be in the ".cpp" files. Beyond that you do not have to know everything that is available in a header file. In some of the header files there may be only one or two things that you may ever use. The rest can be learned as you progress. You can always find someone's code here to spark an idea or see how something new is used.

It is all part of learning what each header file contains and what functions you can use. In the top left of this page there is a link "References" that I use quit often to learn what is in a header file or use it as reference to see how some function is used. After that time an repetition you will learn what you need and find newer things that you can use.

Hope that helps,

Andy
Nov 18, 2019 at 8:38pm
Hi dhayden
thank you David, i appreciate your help and pleased talking with you.

Nov 18, 2019 at 8:42pm
Hi Andy
No worries my friend it always happen in programming, i some times look at my code and can't relies that i forgot a (;).

i appreciate your instructions it is rely helped me and opened my eyes for what i might face in the future.

Thanks a lot
Best regards.

semsemdiver
Last edited on Nov 18, 2019 at 8:43pm
Nov 19, 2019 at 12:10pm
Handy Andy wrote:
Include files like "iostream" and "string" should always be in the ".cpp" files.

Um, what? What is this supposed to mean?

A file should include all the header files it needs to define the things it uses. A file should not include any header files it doesn't need. It is certainly not true that all .cpp files should include those specific header files, or any others that it doesn't need.

Can you explain what it is you're trying to say here?
Last edited on Nov 19, 2019 at 1:03pm
Nov 19, 2019 at 12:19pm
Hello all participants in this nice conversation, excuse me i'm new here and want to know how to mention some one and take a piece of his conv. like this :)
Handy Andy wrote:
Include files like "iostream" and "string" should always be in the ".cpp" files.

thanks a lot

semsemdiver
Nov 19, 2019 at 12:24pm
Hello all participants in this nice conversation, excuse me i'm new here and want to know how to mention some one and take a piece of his conv. like this :)

http://www.cplusplus.com/articles/z13hAqkS/

NB One of the formatting buttons to the right of the edit window allows you to add quote tags easily.
Last edited on Nov 19, 2019 at 12:25pm
Nov 19, 2019 at 1:00pm

MikeyBoy (4992)
thanks a lot :)
Nov 19, 2019 at 1:03pm
You're welcome!
Nov 19, 2019 at 1:07pm
MikeyBoy


if you have any advice to me in order to improve my programming skills as a beginner it would be appreciated :)
it is the first or second participation here and i heard many different opinions so i would like to here from as a professional programmer :)
thanks a lot
Best regards
semsemdiver
Topic archived. No new replies allowed.
Pages: 12