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
Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange
how to test pierrot divisor
how to create a 3x3 two dimensional array that will give you the sums on the left and bottom columns
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.
How can you relate the function with the structure? Explain with an appropriate example.
could you please send the program code for multiplying sparse matrix in c????
Cluster head selection in Wireless Sensor Network using C programming language.
Develop a routine to reflect an object about an arbitrarily selected plane
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
What is full form of PEPSI
What is data _null_? ,Explain with code when u need to use it in data step programming ?
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??
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
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
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']