Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C++ defines an integer array, inputs 10 elements from the keyboard, and then arbitrarily inputs an integer, and uses the sequential method to find the number.
C++ defines an integer array, inputs 10 elements from the keyboard, and then arbitrarily inputs an integer, and uses the sequential method to find the number.
Static electricity Invalid? Main(string[]? Parameter)

{

int[]? Numare? =? New? int[ 10]; //Define an array

Console. WriteLine ("Please enter the number of 10:"); //C++ is printf ("Please enter the number of 10:");

For what? (int? Me? =? 0; ? Me? & lt? Numare. Length; ? i++)//numar。 Length This will get the length of the array. You can also write 10 directly here.

{

numar[I]=? The inside of the analysis (console. ReadLine()); //Get the value typed by the user and store it in the array. C++ should be Scanf or something I haven't forgotten it for a long time

}

Console. WriteLine ("Please enter the number you want to find:"); //C++ is printf ("Please enter the number you want to find:");

int? findNum=int。 Parse (console. ReadLine());

Bull? isfind? =? Fake;

For what? (int? I = 0; I< Numare. Length? ; i++? )

{

What if? (numar[I]? ==? findNum)

{

isfind? =? True; //If you find it,

Console. WriteLine ("This number is at the position of {0}", i);

}

}

If (! isfind)

{

Console. WriteLine ("This number does not exist in the array");

}

}