mercredi 16 décembre 2020

Find numbers using array

I have this kind of problem. I need to separate numbers from string. For example

Sequence length is equal 10
input  a s d @ # $ 7 8 9 1
output 7 8 9 1 a s d @ # $

And this is my code.

   #include <iostream>

   int main() {
   const int N = 1000;
   int input[N];
   int n;
   std::cin>>n;
   int count = 0;
   for (int i = 0; i < n; i++){
       std::cin>>input[i];
    }
   for(int i = 0; i<n; i++){
      if(){
        //here I need to add something 
          }
       }
   for(int i = 0; i<n; i++){
       std::cout<<input[i]<<std::endl;
    }

}

Here at first, I'm giving a sequence length, and after that my array. How can I solve my problem?

Aucun commentaire:

Enregistrer un commentaire