LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2023, 01:22 AM   #16
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337

not really important, just some additional info: https://en.wikipedia.org/wiki/Template_(C%2B%2B)
c++98 is indeed a good start, although I think most of the modern libraries cannot be built with it.
 
Old 11-23-2023, 10:06 AM   #17
YesItsMe
Member
 
Registered: Oct 2014
Posts: 916

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
I learned C++ by writing C++ code. My first steps were eMule mods - I modified them, then started my own ones by copying other people's code, then learned C++ by fixing compilation errors after having done so ...
 
Old 11-29-2023, 08:16 AM   #18
atjurhs
Member
 
Registered: Aug 2012
Posts: 316

Original Poster
Rep: Reputation: Disabled
declaring a double

hey guys,

i'm reading data in from a file and trying to declare one of the variables as a double. trouble is the variable has a
Code:
.
in it's name.
Code:
status_data.time
is the name of the variable. the compiler doesn't like that. what can i do?
 
Old 11-29-2023, 09:02 AM   #19
atjurhs
Member
 
Registered: Aug 2012
Posts: 316

Original Poster
Rep: Reputation: Disabled
i figured out another way to declare the variable
 
Old 11-29-2023, 09:23 AM   #20
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,976

Rep: Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337Reputation: 7337
Quote:
Originally Posted by atjurhs View Post
i figured out another way to declare the variable
you need to show the code you tried, showing just the name of the variable (and also showing a single dot) is just meaningless for us.
But anyway, . means membership (or ownership?), this time field is member of the status_data class or struct, and therefore you can specify the type of the members where you declare the whole class.
 
1 members found this post helpful.
Old 11-29-2023, 11:40 AM   #21
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
If you don't show the relevant excerpt of your actual code and maybe a little bit of your data, then it is unrealistic to expect anyone to be able to help you in any meaningful way. (See the various "stickies" about how to ask an answerable question.)
 
Old 11-29-2023, 12:20 PM   #22
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Quote:
Originally Posted by atjurhs View Post
hey guys,

i'm reading data in from a file and trying to declare one of the variables as a double. trouble is the variable has a
Code:
.
in it's name.
Code:
status_data.time
is the name of the variable. the compiler doesn't like that. what can i do?
The "dot" has special meaning in variable names in C/C++ and most other programming languages. It is not treated as a character but is instead an operator, the dot operator. If you try to treat it as a single character in variable names the compiler will rightfully complain.

As others have suggested, it would be helpful if you included a little more information in your questions. Please review the Site FAQ for guidance in asking well formed questions. Especially visit the link from that page, How to Ask Questions the Smart Way for discussion of things to consider when asking others for help.
 
Old 01-23-2024, 04:08 AM   #23
Mac1ek
LQ Newbie
 
Registered: Jan 2024
Distribution: Debian Linux / Red Hat Enterprise
Posts: 16

Rep: Reputation: 0
Quote:
Originally Posted by atjurhs View Post
i've taken the dive, so can someone share with me a good website/tutorial for a TOTAL newbie to BEGIN learning C++

thanks!
Tutorials with STL references:
https://cplusplus.com/

Good luck!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration