Anúncio

Function Name tooManyTLAsInputs1. (char) A string containing t.pdf

2 de Apr de 2023
Function Name tooManyTLAsInputs1. (char) A string containing t.pdf
Próximos SlideShares
1- Write a function called longestWord that takes the name of a text f.docx1- Write a function called longestWord that takes the name of a text f.docx
Carregando em ... 3
1 de 1
Anúncio

Mais conteúdo relacionado

Mais de ammanelectronic(20)

Anúncio

Function Name tooManyTLAsInputs1. (char) A string containing t.pdf

  1. Function Name: tooManyTLAs Inputs: 1. (char) A string containing the name of the file Outputs: 1. (char) A phrase made from the acronym of the input file Function Description: During a long, boring, not-CS-1371 lecture you and your best friend realize you Solution function [acronym] = tooManyTLAs (fileName) % Opening the file to read fid = fopen(fileName,'r'); % Defining variable to store the acronym acronym = ''; % Reading the first two lines line = fgets(fid); line = fgets(fid); line = fgets(fid); while(ischar(line)) % to check if we still have more lines if(line(1)==' ') % if line is a space, we have to start new word acronym = [acronym ' '] % adding a space for word break else acronym = [acronym line(1)]; % adding the first letter of next line end line = fgets(fid); % reading next line end end
Anúncio