Write a prog to accept a given string in any order and flash
error if any of the character is different.

For example : If abc is the input then abc, bca, cba, cab
bac are acceptable, but aac or bcd are unacceptable.

Answer Posted / santhoo035

#include<iostream.h>
#include<string.h>
int main()
{
int flag=0,i=0,j=0;
char ar[4]="abc" ;
char temp[4];
cout<<"Plz enter a string with size #3";
cin>>temp;
for(j=0;ar[j];j++)
{
flag=0;
for(i=0;temp[i];i++)
{
if(ar[j]==temp[i])
flag+=1;
}
if(flag==0||flag>1)
break;
}
if(flag==0||flag>1)
cout<<"Not accepted";
else
cout<<"Accepted";
}
Note:PLz convert "iostream.h" into "stdio.h" and "cout<<"
to "printf"

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2857


how to test pierrot divisor

2255


how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns

3117


how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.

2136


How can you relate the function with the structure? Explain with an appropriate example.

2915






could you please send the program code for multiplying sparse matrix in c????

3067


Cluster head selection in Wireless Sensor Network using C programming language.

3107


Develop a routine to reflect an object about an arbitrarily selected plane

2992


Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?

3843


What is full form of PEPSI

1862


What is data _null_? ,Explain with code when u need to use it in data step programming ?

2820


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

4140


What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

2401


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2325


To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']

493