bolo17

FindInArray.java

May 9th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FindInArray {
  4. public static void main(String[] args) {
  5. String[] student = {"Christian", "Michael", "Camila", "Sienna", "Tanya", "Connor", "Zachariah", "Mallory", "Zoe", "Emily"};
  6.  
  7. Scanner input = new Scanner(System.in);
  8.  
  9. System.out.println("Enter name student: ");
  10. String name = input.nextLine();
  11.  
  12. boolean isExist = false;
  13. for (int i = 0; i < student.length; i++) {
  14. if (student[i].equals(name)) {
  15. System.out.println("Position of the students in the list " + name + " is: " + (i + 1));
  16. isExist = true;
  17. break;
  18. char** readJson(int* cmdListSize);
  19. bool findInArray(char** array, int arraySize, char* find);
  20.  
  21. int main() {
  22. bool loop = true;
  23. char response[MAX_RESPONSE];
  24.  
  25. int* cmdListSize;
  26. char** cmdList = readJson(cmdListSize);
  27.  
  28. for (int i = 0; i < *cmdListSize; i++) {
  29. printf("%s", cmdList[i]);
  30. }
  31. get link:https://bit.ly/35MLQdi
Add Comment
Please, Sign In to add comment