Chapter 8: C Programming

ARRAYS

Arrays allow you to store a lot of related information in a convenient, organized fashion. An array lets you use one line of code to create a series of variables. These variables share the same basic name and are distinguished from one another by a numerical tag.

Example:

int count[10];

This means that an array named count has 10 members or “elements,” with each element having its own value, starting with 0 and ending with 9. The first element is count[0], the second element is count[1], and so on up to count[9]. The type int means that the actual numerical value of each element is an integer.

Example:

count[2] = 7

count[4] = 131

count[9] = 26

SAMPLE PROGRAM:

This program calculates a one-hour average temperature. The array named "numbers" sets up a series of variables from 0 to 60 to hold a value for input 1 for each minute in an hour. The 60 values are totalled, then averaged. The value of input 2 is then set to this average.

By using an array, the code becomes substantially more concise. The program is first listed, then followed by a section by section explanation of how it works.

int

numbers[60];

/* array: input 1 value for each minute */

int

x;

/* index to the array */

int

total;

/* total of the input 1 values */

int

average;

/* total/60 */

int oldminute;

/* minute counter */

main()

 

{

 

 

if (oldminute != minutes)

{

oldminute = minutes; numbers[minutes] = input(1); total = 0;

for (x=0;x<60;x=x+1)

{

total = total + numbers[x];

}

average = total/60;

if ((total % 60) >= 30)

{

average = average + 1;

}

set_input(2,average);

}

}

103

Page 103
Image 103
Phonetics 5000, 5100 manual Arrays, Sample Program

5000, 5100 specifications

Phonetics 5100 and 5000 represent advanced technology in the realm of communication devices tailored for enhancing auditory experiences through innovative phonetic design. These devices cater to individuals needing auditory assistance, offering features that improve sound clarity and reduce background noise while maintaining a comfortable listening experience.

At the core of both Phonetics 5100 and 5000 are cutting-edge signal processing technologies that enable real-time sound adjustments. This technology allows users to experience tailored sound profiles based on their specific hearing needs or preferences. The devices utilize advanced microphone arrays, which capture sound from various directions, ensuring a 360-degree sound experience. This array not only enhances speech recognition but also filters out unwanted noise, providing a more focused listening environment.

Additionally, both models incorporate artificial intelligence algorithms that learn from the user’s listening habits. This feature allows the devices to automatically adjust settings based on the environments they are frequently used in, such as quiet rooms or bustling outdoor settings. The result is a seamless auditory experience that adapts to the ever-changing acoustic challenges of daily life.

Connectivity options are another significant aspect of the Phonetics 5100 and 5000. Both devices support Bluetooth technology, enabling users to connect them easily to smartphones, televisions, and other audio sources. This capability allows for direct streaming of phone calls and music, enhancing the versatility of the devices. The intuitive companion mobile app allows users to further customize audio settings and manage their device preferences with ease.

The design of the Phonetics 5100 and 5000 also focuses on user comfort and discretion. With a sleek, modern appearance, these devices prioritize aesthetics while ensuring that users feel confident and stylish while wearing them. Lightweight materials and ergonomic designs make them comfortable for extended use.

In summary, Phonetics 5100 and 5000 are robust auditory assistance devices renowned for their innovative sound processing capabilities, user-friendly interfaces, artificial intelligence integration, and stylish comfort. They stand at the forefront of the audiology field, ensuring that users can engage fully in their auditory world.