Computer Science, asked by krishnasajeev921, 8 months ago

In order to perform the following task what will be the input, process and output for the computer Tiping number
Arranging numbers in ascending order
Print a picture
Playing a song Copying a drawing from pen drive to a computer

Answers

Answered by Anonymous
1

Answer:

// CPP program to print all number containing

// 1, 2 and 3 in any order.

#include<bits/stdc++.h>

using namespace std;

// convert the number to string and find

// if it contains 1, 2 & 3.

bool findContainsOneTwoThree(int number)

{

string str = to_string(number);

int countOnes = 0, countTwo = 0, countThree = 0;

for(int i = 0; i < str.length(); i++) {

if(str[i] == '1') countOnes++;

else if(str[i] == '2') countTwo++;

else if(str[i] == '3') countThree++;

}

return (countOnes && countTwo && countThree);

}

// prints all the number containing 1, 2, 3

string printNumbers(int numbers[], int n)

{

vector<int> oneTwoThree;

for (int i = 0; i < n; i++)

{

// check if the number contains 1,

// 2 & 3 in any order

if (findContainsOneTwoThree(numbers[i]))

oneTwoThree.push_back(numbers[i]);

}

// sort all the numbers

sort(oneTwoThree.begin(), oneTwoThree.end());

string result = "";

for(auto number: oneTwoThree)

{

int value = number;

if (result.length() > 0)

result += ", ";

result += to_string(value);

}

return (result.length() > 0) ? result : "-1";

}

// Driver Code

int main() {

int numbers[] = { 123, 1232, 456, 234, 32145 };

int n = sizeof(numbers)/sizeof(numbers[0]);

string result = printNumbers(numbers, n);

cout << result;

return 0;

}

// This code is contributed

Answered by shahzebhusain220
0

Answer:

keyboad

Explanation:

typing numbers

Similar questions