Monday, September 22, 2014

[Delivery] Number array

Bài 1: Write a program that asks the user to type 10 integers of an array. The program must compute and write how many integers are greater than or equal to 10.


My code + result 



Bài 2: Write a program that asks the user to type 10 integers of an array. The program must output the largest element in the array, and the index at which that element was found.



My code + result 


Bài 3: Input values are accepted from the user into the array. Displays highest of the entered values. Prints average of values entered.







Bài 4: Write a program that accepts the following numbers in an array and reverses the array.



My code + result 


Bài 5: Write a program to count the number of vowels in a line of text.



My code + result 


Bài 6: Write a program that asks the user to type 10 integers of an array and an integer V. The program must search if V is in the array of 10 integers. The program writes "V is in the array" or "V is not in the array".



My code + result 



Bài 7: Write a program that asks the user to type 10 integers of an array and an integer value V. The program must search if the value V exists in the array and must remove the first occurrence of V, shifting each following element left and adding a zero at the end of the array. The program must then write the final array.



My code + result 


Bài 10: Write a program that asks the user to type 10 integers of an array. The program will then sort the array in descending order and display it.



My code + result




Bài học rút ra:
  • Cấu trúc mảng: storage_class data_type array_name[size_expr]
  • Bubble sort: chọn ra giá trị lớn nhất và sắp xếp lại
  • Insertion sort: chọn ra 1 giá trị rồi sắp xếp. Rồi lại chọn 1 giá trị khác và sắp xếp tiếp

No comments:

Post a Comment