10th Simple C++ Program - Tutorial

ssendi By ssendi, 13th Apr 2012 | Follow this author | RSS Feed | Short URL http://nut.bz/312z2qck/
Posted in Wikinut>Guides>Technology>Computer Software

In this program user types several numbers and program using "array" can memories that numbers, and it writes those numbers the way that user wants.....from first to last, or from last to first..

10th Simple C++ Program - Tutorial

#include <iostream>
using namespace std;
int main()
{
int option=1;
while(option!=0){
cout<<"How many numbers you want to enter: ";
int howMany;
cin>>howMany;
int array;
cout<<"Write those numbers: "<<endl;
for(int i=0;i<howMany;i++){
cin>>array;

}
cout<<endl<<endl;;
cout<<"Choose the option that you want: "<<endl;
cout<<"1) Write from first to last..... "<<endl;
cout<<"2) write from last to first..... "<<endl;
cout<<"0) Exit... "<<endl;
cin>>option;
cout<<endl;
switch(option){
case 1:{
for(int i=0;i<howMany;i++){
cout<<array<<", ";
}

break;
}
case 2:{
for(int i=howMany-1;i>=0;i--){
cout<<array<<", ";
}
break;
}

}
cout<<endl;
}
cout<<endl<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}


Here you can find more C++ Programs......

moderator Peter B. Giblett moderated this page.
If you have any complaints about this content, please let us know

Comments

author avatar The Elements
27th Apr 2012 (#)

I have heard of C++ Program before but i am not at using it. but nice tips you have though...

Reply to this comment

author avatar ssendi
28th Apr 2012 (#)

I'll also give some tips from HTML and JAVA...

Reply to this comment

author avatar prakashgp
18th May 2012 (#)

Whoever wants to know internet, computer tricks, programming and web design tricks. Simple hacks etc please visit http://techscan99.blogspot.com

Reply to this comment

author avatar cnwriter..carolina
26th May 2012 (#)

interesting...even if I dont understand....thanks

Reply to this comment

author avatar Denise O
29th Jun 2012 (#)

Thank you for sharing.:)

Reply to this comment

Add a comment
Username
Can't login?
Password