Hi all,
Jesse Liberty writes:
"cin.get() >>myVarOne >myVarTwo; // illegal
The return value of (cin.get() >myVarOne) is an integer, not an
iostream object."
( http://newdata.box.sk/bx/c/htm/ch16.htm)
I would think that that the reason why this wouldn't work is because
cin.get() returns an int, not because (cin.get() >mVarOne) is an
integer...
Anyone agree?
Taras 5 2131
"Taras_96" <ta******@gmail .comwrote in message
Hi all,
Jesse Liberty writes:
"cin.get() >>myVarOne >myVarTwo; // illegal
The return value of (cin.get() >myVarOne) is an integer, not an
iostream object."
(http://newdata.box.sk/bx/c/htm/ch16.htm)
I would think that that the reason why this wouldn't work is because
cin.get() returns an int, not because (cin.get() >mVarOne) is an
integer...
Anyone agree?
If mVarOne is an integral type then (cin.get() >mVarOne) would return an
integer. The code won't even compile if mVarOne has any other type.
-- http://techytalk.googlepages.com
On Apr 30, 6:21 am, Taras_96 <taras...@gmail .comwrote:
Hi all,
Jesse Liberty writes:
"cin.get() >>myVarOne >myVarTwo; // illegal
The return value of (cin.get() >myVarOne) is an integer, not an
iostream object."
The author probably means that "it will not work the way one might
expect." It is illegal only if myVarOne or myVarTwo is uninitialized.
(I don't remember whether the values must be less than or equal to the
total bits in 'int'.)
cin.get() >myVarOne
is the result of an int shifted right by the value of myVarOne
/* ... */ >myVarTwo
is further shifting the result of the previous operation right some
more.
>
(http://newdata.box.sk/bx/c/htm/ch16.htm)
I would think that that the reason why this wouldn't work is because
cin.get() returns an int, not because (cin.get() >mVarOne) is an
integer...
The code should compile and work in that possibly unexpected way.
Ali
<ac******@gmail .comwrote in message
On Apr 30, 6:21 am, Taras_96 <taras...@gmail .comwrote:
>Hi all,
Jesse Liberty writes:
"cin.get() >>myVarOne >myVarTwo; // illegal
The return value of (cin.get() >myVarOne) is an integer, not an iostream object."
The author probably means that "it will not work the way one might
expect." It is illegal only if myVarOne or myVarTwo is uninitialized.
(I don't remember whether the values must be less than or equal to the
total bits in 'int'.)
I think (after looking at the link provided by OP) probably the author means
that this code won't work the way "cin >mVar1 >mVar2" would have worked.
<Quote from link>
When you write cin >VarOne >varTwo >varThree;, the first extraction is
evaluated (cin >VarOne). The return value from this is another istream
object, and that object's extraction operator gets the variable varTwo. It
is as if you had written this: ((cin >varOne) >varTwo) >varThree;
</Quote from link>
-- http://techytalk.googlepages.com
On Apr 30, 3:21 pm, Taras_96 <taras...@gmail .comwrote:
Jesse Liberty writes:
"cin.get() >>myVarOne >myVarTwo; // illegal
The return value of (cin.get() >myVarOne) is an integer, not
an iostream object."
(http://newdata.box.sk/bx/c/htm/ch16.htm)
I would think that that the reason why this wouldn't work is
because cin.get() returns an int, not because (cin.get() >>
mVarOne) is an integer...
Anyone agree?
As others have pointed out, 1) it's not illegal (since myVarOne
and myVarTwo have type char), but 2) it almost certainly doesn't
mean what you want.
I might add in general that, having taken a quick look at the
page, it seems full of errors. I didn't read it in detail, but
of the four or five sentences I did notice, about have were
wrong. I don't think I'd recommend this text.
--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Thanks everyone - I didn't even think of the shift operator :)
Taras This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kangol kangoll |
last post by:
hi, i've been trying to figure out how to make visual basic start
extracting text at a certain line to when i tell it to stop. I am making
trying to make a program where it extracts text from a text file and
inserts it into a database. But right now i'm stuck at finding a way to
code it so the text extraction doesn't start till after the second set
of dashes, here is part of text file. I want to extract ACL ET AL
SNIPELK 8-27-70-18 and so...
|
by: svilen |
last post by:
hello again.
i'm now into using python instead of another language(s) for
describing structures of data, including names, structure,
type-checks, conversions, value-validations, metadata etc. And i have
things to offer, and to request.
And a lot of ideas, but who needs them....
here's an example (from type_struct.py):
|
by: Howell, Scott |
last post by:
I am looking for a simple extraction/load program to load data daily from a
Progress 8.3B database via ODBC to a mysql 3.23.57 database. It does not
necessarily need to do any data-type transforms. It need to run on Windows
2000 and be able to run it as a service, or as a cron task if running under
Unix. Any suggestions?
--
|
by: Jason Huang |
last post by:
Hi,
Would someone show me how to do the data extraction to Excel in ASP.Net
using C# web form?
I am not familiar with VB, so I am asking someone to help me out!
Any help will be appreciated.
Jason
|
by: yeutim |
last post by:
I can't find anything wrong this with this class. Especially,
Overloading Stream-Extraction Operator (in blue). Any one know what
do I need to fix this problem please reply. Thank you for your help!
---------------------------------------------
class MyData{
| |
by: James Lehman |
last post by:
Hello.
I want to write a program that reads AutoCAD shape (font) files. They are
written with the convention that hexadecimal values have a leading zero and
decimal values do not. All numbers can be negative or positive. All numbers
can be stored in a single byte. My questions is: can ifstream extraction
into an int see the leading zero and interpret the number as hex and can I
ask the ifstream, right after the extraction, if the value I...
|
by: dec01louis |
last post by:
Hi all, actually i'm now doing something on license plate recognition system for my project. The first step would be the license plate extraction algorithm which means it is needed to extract a license plate from an image captured. So, i wonder how can this be done? Actually i'm thinking of something like detect the image pixels of the license plate since the license plate that i'm gonna work on at this stage is black and white in color. So that...
|
by: EM.Bateman |
last post by:
Working on Visual Studio .Net I've implemented a class:
#ifndef CONTRIBUTOR_H
#define CONTRIBUTOR_H
enum Gender {male=1, female, unk};
#include <iostream>
#include <iomanip>
#include <string>
|
by: newbarker |
last post by:
Hello all,
#include <sstream>
#include <iostream>
int main()
{
std::istringstream iss("6.5e");
double size;
char fit;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |