GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 237 of 258    Print  
Write a c++ program to accept three digits (i.e 0-9)and print all possible combinations fro these digits.(for exanple if the three digits are 1,2,3 then all possible combinations are 123,132,231,213,312,321 etc)

  
Total Answers and Comments: 2 Last Update: February 12, 2007     Asked by: Chinmayee Satapathy 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 23, 2006 13:03:52   #1  
Yanesh Tyagi        

RE: Write a c++ program to accept three digits (i.e 0-...

/* Program to write combination of 3 digit number
Author : Rachit Tyagi
Date : 23-Dec-2006 2345 IST
*/

#include<iostream.h>
#include<conio.h>
void main(){
clrscr();
const int s 3;
int a[s];
int x y z;
for (int i 0; i<s; i++)
cin >> a[i];
x a[0];
y a[1];
z a[2];
i 0;
cout<<x<<y<<z;
cout<< n ;
while(1){
a[s] a[i];
if (i ! s - 1){
a[i] a[i+1];
a[i+1] a[s];
}
else {
a[i] a[0];
a[0] a[s];
i -1;
}
i++;

if (a[0] x && a[1] y && a[2] z)
break;

for (int j 0; j < s; j++)
cout<<a[j];
cout<< n ;

}
getch();

}


 
Is this answer useful? Yes | No
February 12, 2007 02:19:34   #2  
manochasunil Member Since: February 2007   Contribution: 1    

RE: Write a c++ program to accept three digits (i.e 0-...
int a[3]; a[0] 1; a[1] 2; a[2] 3; // Print all the permutations of a three digit number for (int i 0; i< 2;i++) { for (int j 0; j< 2;j++) { if(i! j) { printf( d a[i]); printf( d a[j]); for (int k 0; k< 2;k++) { if((i! k)&& j! k) { printf( dn a[k]); } } } } }
 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : All the solutions above are reading the source code with the files concepts.find a solution where you do not have a source file to read the contents.There is a macro or an attiribute which tells the compiler the name of the program, function or the attribute. ...

Latest Answer : In C it is System("program_to_run.exe"); In Windows it can be ShellExecute(); or WinExec(); ...

Latest Answer : In Linux/Unix , we have the header file dirent.h.This .h file contains the direcory manipulation functions Some of the functions are opendir,closedir,readdir. ...

Latest Answer : #include main(int argc, char *argv[]){  printf("Removing: %s...n", argv[0]);  remove(argv[0]);} ...

Latest Answer : 7150u have to worry because this is a master program i had created when i started with c ...

Latest Answer : You can write Multithreading application by using POSIX library of Linux ...

Latest Answer : typedef enum {read,blue,green}color; void main() { color a = 1;    // Error in C++} ...

Where does global, static, local, register variables, free memory and C Program instructions get stored?

Latest Answer : *(*(*(*(a+i)+j)+k)+l) ...
Tags : Pointer

Latest Answer : The advantages of using pointers are: 1: you can work with the address of the variable2: you can reference the variables in more different easiest ways....    e.g  int a[10],*b;                b=&a;         if you want to refer ...


 Sponsored Links

 
Related Articles

Print Servers

Print Servers Print server is a server or advice that is used to connect many printers of a network to it Using the print server any computer on the network can give a print command to the server and the print server will get the job done accordingly Usually a print server is configured on a compute
 

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960&rsquo; s The term object oriented programming&rsquo; was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

How to develop compile and run a C program

The steps involved in building a C program are: 1. First program is created by using any text editor and the file is stored with extension as .c 2. Next the program is compiled. There are many compilers available&nbsp;like GNU C compiler called as gcc, Sun compiler, Borland compiler which is pop
 

Quality Aspects to Check While Writing COBOL Program

Quality Aspects to Check While Writing COBOL Program This article gives a general list which the programmer must check while delivering programs developed in COBOL This can also be used as a general checklist for checking quality of the COBOL program developed mosgoogle Quality is a vital factor fo
 

The Inheritance Concept In OOPs

The Inheritance Concept In OOPs In object oriented programming objects will be characterised by classes It is possible to learn a lot about an object based on the class it belongs to Even if you are not familiar with the name Maybach If I told you it is a car you would immediately know that it has f
 

Understanding The Message Concept In OOPs

Understanding The Message Concept In OOPs To understand object oriented programming you will need to become familiar with messages As the name implies a message is a process in which software objects will communicate with one another Because of this having one object is not enough mosgoogle An objec
 

How To Write The Main Heading For Your Essay

How To Write The Main Heading For Your Essay When you write an essay you will want to make sure you write a good heading To write a good heading you will need to plan your essay very effectively If you remember any good points from lectures these could be things you may want to use to create a good
 

How To Write a Good Essay

How To Write a Good Essay While there are many different methods you can use to write an essay standard essays will follow specific formats Understanding the basic format of an essay will allow you to write informative articles which will capture the attention of those that read it mosgoogle The fir
 

How To Write A College Essay

How To Write A College Essay The best way to write a college essay is to start by brainstorming ideas You will also want to make a list of topics you re interested in While there are other ways you can write a college level essay this method is the easiest mosgoogle When you brainstorm you will want
 

Basic concepts of OOPS and Structure of C++ program

Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape