473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

what is the output

29
what is the output of the the following code,if the user give"today is thursday" ?


const int LENGTH = 18;
char message_[LENGTH];
std::cout<<"which day is today?"<<std::endl;
std::cin>>message_;
std::cout<<message_<<std::endl;
Jun 11 '07 #1
7 1591
locy
29
what is the output of the following code?



int found = 0, count = 5;
if( ! found | | --count == 0)
std::cout<<"danger"<<std::endl;
std::cout<<"count = "<<count<<std::endl;
Jun 11 '07 #2
sicarie
4,677 Expert Mod 4TB
what is the output of the following code?



int found = 0, count = 5;
if( ! found | | --count == 0)
std::cout<<"danger"<<std::endl;
std::cout<<"count = "<<count<<std::endl;
Did you try putting this into a compiler?
Jun 11 '07 #3
RedSon
5,000 Expert 4TB
what is the output of the following code?



int found = 0, count = 5;
if( ! found | | --count == 0)
std::cout<<"danger"<<std::endl;
std::cout<<"count = "<<count<<std::endl;
Please do not double post very similar questions. You can create one thread per question.

-MODERATOR
Jun 11 '07 #4
locy
29
[quote=sicarie]Did you try putting this into a compiler?

yes,i could not get the result.
Jun 12 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
what is the output of the the following code,if the user give"today is thursday" ?


const int LENGTH = 18;
char message_[LENGTH];
std::cout<<"which day is today?"<<std::endl;
std::cin>>message_;
std::cout<<message_<<std::endl;
The result is: today

The >> operator stops at the first whitespace character so you only get the word today.

If you are trying to get today is Thursday, then you need to get the entire string. Use cin.getline() for this.
Jun 12 '07 #6
locy
29
The result is: today

The >> operator stops at the first whitespace character so you only get the word today.

If you are trying to get today is Thursday, then you need to get the entire string. Use cin.getline() for this.
thankx,
how did u implement "const int LENGTH = 18" and
"char message_[LENGTH]"
Jun 12 '07 #7
weaknessforcats
9,208 Expert Mod 8TB
how did u implement "const int LENGTH = 18" and
"char message_[LENGTH]"
I'm not sure what you mean. I just looked at your code.
Jun 14 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Glutinous | last post by:
Trying to learn php, and came across =& as in $form =& $HTTP_POST_VARS; I can't find any reference to =&, with no success in searching for a definition (as though it's _so_ obvious it...
9
by: Sims | last post by:
Hi, I recall a function that would tell me how long it took to generate an output. But for the life of me I cannot remember it. Dow anybody know it? Or do I have to write something myself,...
58
by: Jeff_Relf | last post by:
Hi Tom, You showed: << private const string PHONE_LIST = "495.1000__424.1111___(206)564-5555_1.800.325.3333"; static void Main( string args ) { foreach (string phoneNumber in Regex.Split...
7
by: Neil Zanella | last post by:
OK, this time the compiler's got me a little bit puzzled, simply because it is doing something I am not expecting. My understanding, according to the documentation of std::vector<>::resize(), is...
2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
24
by: kalamantina | last post by:
#include "stdafx.h" #include <stdio.h> #define output( x ) printf( #x "\r\n" );fflush( stdout ) class CMyBase { public: CMyBase() { output( CMyBase() ); f(*this);
1
by: aboood | last post by:
Hi guys Could any one tell me what does that code do please? in pseudo-code #include <fstream.h> #include <iostream.h> bool differsByOneDigit ( int , int ); void outputResults ( ofstream & ,...
23
by: mahesh | last post by:
Hi all, I have following code that is supposed to increase the power by specified value. int main() { system("cls"); int i, exponent; double base; double new_base=0.0;
0
by: Philluminati | last post by:
I have a Perl SOAP Server which returns this SOAP Message when invoked: <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance"...
69
by: Yee.Chuang | last post by:
When I began to learn C, My teacher told me that pointer is the most difficult part of C, it makes me afraid of it. After finishing C program class, I found that all the code I wrote in C contains...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.