helo
juz want to ask
if i write like this
cout<< ' \n 1-package a \n2- package b " ;
then what should i put in cin??

Recommended Answers

All 5 Replies

Member Avatar for Javam

Sorry your question does not make sense. How can we know what you want to pass to cin?...also, you open the "string" with a ' and close with a ".

i mean that
i juz put the package as at declaration
for easy my work, i use no to help customer to choose the packages
that's y i cout<< "\n1-package A \n2- package B" ;
then i dun know what should i put in cin

You dont put things in cin. cin is a stream operator; you use it to extract elements from a stream.

As an aside, the language of your post will (in the general case) cause less people to respond seriously. 'Q' is not a suitable substitution for 'Question'; juz is not a word and should not be used in place of just; randomly dropping letters is not appropriate. This is, of course, only my opinion - you can feel free to discard it as you see fit.

commented: I put the title in when I split it from a hijack... +15

I believe he is trying to do this:

#include <iostream>

using namespace std;

char Package;

int main()
{
  cout<<"Choose a package: 1 = Package A, 2 = Package B\n";
  cin>>Package;                         //This is how u get the user choice..

  if(Package == '1')                    //I guess u mean split choice by if and else meaning if this then... else...
  {
    //Do stuff
  }
  else if(Package == '2')               //The If and else statement will let do something depending on the choice made.
  {
    //Do stuff
  }
return 0;
}
commented: bad code -1
commented: And why do his homework for him? -3
commented: Global variable = bad, bad, bad. +0

ok..thanks a lot 4 ur help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.