Wednesday 4 April 2012

Lecture: 27


                                                Lecture 27
Conditional Statements (Decision Making)
Code:
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
  char ch;
  ch=getche();
  if(ch=='y')
      cout<<"\nYou typed y. ";
  else
      cout<<"\nYou didn't type y. ";   
  getch();
  return 0;
}

Code view in dev compiler:

Compile the program Ctrl+F9

      Run program Ctrl+F10