My Simple C++ Program which hangs out with Age :)

C, C++, Visual C++, C++.Net Topics
Post Reply
User avatar
Nipuna
Moderator
Moderator
Posts: 2729
Joined: Mon Jan 04, 2010 8:02 pm
Location: Deraniyagala,SRI LANKA

My Simple C++ Program which hangs out with Age :)

Post by Nipuna » Mon Apr 04, 2011 12:44 pm

Here is a Simple Program I Wrote Today Using Dev C++ :)

I started Learning C++ Few Days ago (May be 4 Days or Low, I couldn't study some days because of some little things :) )

I used Do while Loop, I made some programs using " If" and "While". But this is the only one Left I deleted the others. :)

Code: Select all

#include<iostream>
#include<string>
#include<sstream>
using namespace std;

int main ()
{

string age;
int iage;

cout<<"Enter your Age [Enter Number Below 18] :";
getline(cin,age);
stringstream (age)>>iage;
cout<<iage<<" You are Still a Kid.... Press Enter for the Rest  \n";

cin.get();

do
{
            iage++;
            cout<<iage<<" , ";     
}

    while(iage<18);

cout<<"Now You Are An Adult :D";

cin.get();

return 0;
}



Tell Me your Ideas I like to Know :)
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: My Simple C++ Program which hangs out with Age :)

Post by Neo » Fri Apr 08, 2011 1:33 am

No time to read programs. If you have a problem/error, ask the question by mentioning the line number.
Post Reply

Return to “C/C++ Programming”