🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: att.lang.c++
Article #23

newb if else question

#23
From: Mitch
Date: Tue, 04 Jan 2005 13:00
17 lines
1662 bytes
when using CIN
How do i make it so user input can be 5 or 6 letters
and
how do i put input into an if else statement ?
Example, i want the user to be able to input a word then program to decide
what word to spit out.

char input;
cout<<"Hi ";
cin>>input
if (input= = "Hello" ){
cout<<"Hello\n";
}
else{
cout<<"goodbye\n";
}
?
Technical Details
Message-ID: <kvKdnYnpIKZxD0fcRVn-gg@rogers.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsprint.newsread.com!newsread.com!news-xfer.newsread.com!tdsnet-transit!newspeer.tds.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.cwix.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.rogers.com!news.rogers.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10d4ba,c27b3e74b3d91879,start
X-Google-Attributes: gid10d4ba,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newsprint.newsread.com!newsread.com!news-xfer.newsread.com!tdsnet-transit!newspeer.tds.net!nntp1.roc.gblx.net!nntp.gblx.net!nntp.gblx.net!newsfeed.cwix.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.rogers.com!news.rogers.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 04 Jan 2005 06:58:20 -0600
From: "Mitch" <balugious@yahoo.com>
Newsgroups: att.lang.c++
Subject: newb if else question
Date: Tue, 4 Jan 2005 08:00:39 -0500
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <kvKdnYnpIKZxD0fcRVn-gg@rogers.com>
Lines: 19
NNTP-Posting-Host: 69.198.58.64
X-Trace: sv3-1GfsDRCiAOjv7Q1ieGDfWhGyqggjcLzwlySntWAdUlMAU4k+0tjorqyqVhJhYx/nuT23XEv7Ef6Ve2C!Oss3CvdXUCU7MDtG/eKXIa+I2WcSE2CHPsNVStLWZ+TAv61PeI7Og8sZDrL8RVOwWefVG8k=
X-Complaints-To: abuse@rogers.com
X-DMCA-Complaints-To: radman@rogers.wave.ca
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.22