Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in C pls Sample Output 0 0 0 0 0 0 0 0 0 0 0 1 3 2 1 2 1 1 1

Write in C pls

image text in transcribed

Sample Output 0 0 0 0 0 0 0 0 0 0 0 1 3 2 1 2 1 1 1 0 0 1 1 5 2 1 2 1 2 0 0 1 1 1 2 1 2 1 2 0 0 1 2 1 2 4 4 3 1 0 0 2 1 1 2 4 4 4 1 0 0 1 1 2 1 3 4 3 1 0 0 2 1 1 2 2 2 1 1 0 0 1 1 2 3 2 1 2 1 0 0 0 0 0 0 0 0 0 0 0 The finger location is at the coordinate (6,7).

A resistive film touch screen determines the finger location by detecting changes in the pressure applied to the film. Consider that the screen is represented by a 10x10 grid. Each grid cell individually records the pressure applied to the screen. The finger location is determined as the grid cell with the highest average value, where the average value is determined by the mean of the three-by-three sub-grid that surrounds it. Develop a program that reads the pressure values of the 10x10 grid from a file called pressure.txt (or pressure1.txt) into a two-dimensional array and then determines the grid location where the finger touches the screen. Ignore the border cells as candidate finger locations. Your code should use a function called fingerLoc to determine the coordinates of the finger. The fingerLoc function has the following prototype: void fingerLoc(int screen][10], int *xp, int typ); The screen array represents the pressure values. The xp and yp pointers are used to return the coordinates of the finger location. Sample file with pressure values (pressure.txt). 0000000000 0132121110 0115212120 0111212120 0121244310 0211244410 0112134310 0211222110 0112321210 0000000000 The finger location is at (6, 7) coordinate. Develop a program that: a) Reads a 10x10 two-dimensional array from the file pressure.txt (or pressure1.txt). Use the following function prototype for reading the array void readAr (FILE *in, int x[ ][10]); b) Computes the finger location c) Prints the 2 dim array plus finger location

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

Analyze the FXIP screen.based on sweden

Answered: 1 week ago

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago