1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alborosie
3 years ago
6

The following C program asks the user for two input null-terminated strings, each stored in uninitialized 100-byte buffer, and c

ompares them. The program then shows the alphabetical order of both strings, by reporting whether the first is less than the second, the second is less than the first, or both are equal.#include «stdio·h> int main() // Two strings, 100 bytes allocated for each char si [100; char s2 [100]; // Read string 1 printf("Enter string scanf("%s", s1); 1: "); // Read string 2 printf("Enter string scanf("%s", s2); 2: "); // Compare them int index = 0; while (1) / Load characters from s1 and s2 char c1 = s1[index]; char c2 = s2[index]; // Current character is greater for s1 if (c1 > c2) printf("s1 > s2\n") break; // Current character is greater for s2 if (c1 < c2) printf("s1
Engineering
1 answer:
marissa [1.9K]3 years ago
3 0

Answer:

Code is given below:

Explanation:

.data  

str1: .space 20  

str2: .space 20  

msg1:.asciiz "Please enter string (max 20 characters): "  

msg2: .asciiz "\n Please enter string (max 20 chars): "  

msg3:.asciiz "\nSAME"  

msg4:.asciiz "\nNOT SAME"  

.text

.globl main

main:  

   li $v0,4        #loads msg1  

   la $a0,msg1  

   syscall

   li $v0,8

   la $a0,str1

   addi $a1,$zero,20

   syscall          #got string to manipulate

   li $v0,4        #loads msg2

   la $a0,msg2

   syscall

   li $v0,8

   la $a0,str2

   addi $a1,$zero,20

   syscall         #got string  

       la $a0,str1             #pass address of str1  

   la $a1,str2         #pass address of str2  

   jal methodComp      #call methodComp  

   beq $v0,$zero,ok    #check result  

   li $v0,4

   la $a0,msg4

   syscall

   j exit

ok:  

   li $v0,4  

   la $a0,msg3  

   syscall  

exit:  

   li $v0,10  

   syscall  

methodComp:  

   add $t0,$zero,$zero  

   add $t1,$zero,$a0  

   add $t2,$zero,$a1  

loop:  

   lb $t3($t1)         #load a byte from each string  

   lb $t4($t2)  

   beqz $t3,checkt2    #str1 end  

   beqz $t4,missmatch  

   slt $t5,$t3,$t4     #compare two bytes  

   bnez $t5,missmatch  

   addi $t1,$t1,1      #t1 points to the next byte of str1  

   addi $t2,$t2,1  

   j loop  

missmatch:    

   addi $v0,$zero,1  

   j endfunction  

checkt2:  

   bnez $t4,missmatch  

   add $v0,$zero,$zero  

endfunction:  

   jr $ra

You might be interested in
.........................................
hoa [83]

Answer:

Engineering is the use of scientific principles to design an build machines, structure, an other item including bridges, tunnels, road etc

3 0
3 years ago
The present worth of income from an investment that follows an arithmetic gradient is projected to be $475,000. The income in ye
Nikitich [7]

Answer:

G = $37,805.65

Explanation:

I found this on another site:

475,000 = 25,000(P/A,10%,6) + G(P/G,10%,6)

475,000 = 25,000(4.3553) + G(9.6842)

9.6842G = 366,117.50

G = $37,805.65

4 0
3 years ago
Three tool materials (high-speed steel, cemented carbide, and ceramic) are to be compared for the same turning operation on a ba
Tpy6a [65]

Answer:

Among all three tools, the ceramic tool is taking the least time for the production of a batch, however, machining from the HSS tool is taking the highest time.

Explanation:

The optimum cutting speed for the minimum cost

V_{opt}= \frac{C}{\left[\left(T_c+\frac{C_e}{C_m}\right)\left(\frac{1}{n}-1\right)\right]^n}\;\cdots(i)

Where,

C,n = Taylor equation parameters

T_h =Tool changing time in minutes

C_e=Cost per grinding per edge

C_m= Machine and operator cost per minute

On comparing with the Taylor equation VT^n=C,

Tool life,

T= \left[ \left(T_t+\frac{C_e}{C_m}\right)\left(\frac{1}{n}-1\right)\right]}\;\cdots(ii)

Given that,  

Cost of operator and machine time=\$40/hr=\$0.667/min

Batch setting time = 2 hr

Part handling time: T_h=2.5 min

Part diameter: D=73 mm =73\times 10^{-3} m

Part length: l=250 mm=250\times 10^{-3} m

Feed: f=0.30 mm/rev= 0.3\times 10^{-3} m/rev

Depth of cut: d=3.5 mm

For the HSS tool:

Tool cost is $20 and it can be ground and reground 15 times and the grinding= $2/grind.

So, C_e= \$20/15+2=\$3.33/edge

Tool changing time, T_t=3 min.

C= 80 m/min

n=0.130

(a) From equation (i), cutting speed for the minimum cost:

V_{opt}= \frac {80}{\left[ \left(3+\frac{3.33}{0.667}\right)\left(\frac{1}{0.13}-1\right)\right]^{0.13}}

\Rightarrow 47.7 m/min

(b) From equation (ii), the tool life,

T=\left(3+\frac{3.33}{0.667}\right)\left(\frac{1}{0.13}-1\right)\right]}

\Rightarrow T=53.4 min

(c) Cycle time: T_c=T_h+T_m+\frac{T_t}{n_p}

where,

T_m= Machining time for one part

n_p= Number of pieces cut in one tool life

T_m= \frac{l}{fN} min, where N=\frac{V_{opt}}{\pi D} is the rpm of the spindle.

\Rightarrow T_m= \frac{\pi D l}{fV_{opt}}

\Rightarrow T_m=\frac{\pi \times 73 \times 250\times 10^{-6}}{0.3\times 10^{-3}\times 47.7}=4.01 min/pc

So, the number of parts produced in one tool life

n_p=\frac {T}{T_m}

\Rightarrow n_p=\frac {53.4}{4.01}=13.3

Round it to the lower integer

\Rightarrow n_p=13

So, the cycle time

T_c=2.5+4.01+\frac{3}{13}=6.74 min/pc

(d) Cost per production unit:

C_c= C_mT_c+\frac{C_e}{n_p}

\Rightarrow C_c=0.667\times6.74+\frac{3.33}{13}=\$4.75/pc

(e) Total time to complete the batch= Sum of setup time and production time for one batch

=2\times60+ {50\times 6.74}{50}=457 min=7.62 hr.

(f) The proportion of time spent actually cutting metal

=\frac{50\times4.01}{457}=0.4387=43.87\%

Now, for the cemented carbide tool:

Cost per edge,

C_e= \$8/6=\$1.33/edge

Tool changing time, T_t=1min

C= 650 m/min

n=0.30

(a) Cutting speed for the minimum cost:

V_{opt}= \frac {650}{\left[ \left(1+\frac{1.33}{0.667}\right)\left(\frac{1}{0.3}-1\right)\right]^{0.3}}=363m/min [from(i)]

(b) Tool life,

T=\left[ \left(1+\frac{1.33}{0.667}\right)\left(\frac{1}{0.3}-1\right)\right]=7min [from(ii)]

(c) Cycle time:

T_c=T_h+T_m+\frac{T_t}{n_p}

T_m= \frac{\pi D l}{fV_{opt}}

\Rightarrow T_m=\frac{\pi \times 73 \times 250\times 10^{-6}}{0.3\times 10^{-3}\times 363}=0.53min/pc

n_p=\frac {7}{0.53}=13.2

\Rightarrow n_p=13 [ nearest lower integer]

So, the cycle time

T_c=2.5+0.53+\frac{1}{13}=3.11 min/pc

(d) Cost per production unit:

C_c= C_mT_c+\frac{C_e}{n_p}

\Rightarrow C_c=0.667\times3.11+\frac{1.33}{13}=\$2.18/pc

(e) Total time to complete the batch=2\times60+ {50\times 3.11}{50}=275.5 min=4.59 hr.

(f) The proportion of time spent actually cutting metal

=\frac{50\times0.53}{275.5}=0.0962=9.62\%

Similarly, for the ceramic tool:

C_e= \$10/6=\$1.67/edge

T_t-1min

C= 3500 m/min

n=0.6

(a) Cutting speed:

V_{opt}= \frac {3500}{\left[ \left(1+\frac{1.67}{0.667}\right)\left(\frac{1}{0.6}-1\right)\right]^{0.6}}

\Rightarrow V_{opt}=2105 m/min

(b) Tool life,

T=\left[ \left(1+\frac{1.67}{0.667}\right)\left(\frac{1}{0.6}-1\right)\right]=2.33 min

(c) Cycle time:

T_c=T_h+T_m+\frac{T_t}{n_p}

\Rightarrow T_m=\frac{\pi \times 73 \times 250\times 10^{-6}}{0.3\times 10^{-3}\times 2105}=0.091 min/pc

n_p=\frac {2.33}{0.091}=25.6

\Rightarrow n_p=25 pc/tool\; life

So,

T_c=2.5+0.091+\frac{1}{25}=2.63 min/pc

(d) Cost per production unit:

C_c= C_mT_c+\frac{C_e}{n_p}

\Rightarrow C_c=0.667\times2.63+\frac{1.67}{25}=$1.82/pc

(e) Total time to complete the batch

=2\times60+ {50\times 2.63}=251.5 min=4.19 hr.

(f) The proportion of time spent actually cutting metal

=\frac{50\times0.091}{251.5}=0.0181=1.81\%

3 0
3 years ago
An inventor claims to have invented a heat engine that operates between the temperatures of 627°C and 27°C with a thermal effici
Oksana_A [137]

Answer Explanation:

the efficiency of the the engine is given by=1-\frac{T_2}{T_1}

where T₂= lower temperature

           T₁= Higher temperature

we have given efficiency =70%

lower temperature T₂=27°C=273+27=300K

higher temperature T₁=627°C=273+627=900K

efficiency=1-\frac{T_2}{T_1}

                =1-\frac{300}{900}

                 =1-0.3333

                 =0.6666

                 =66%

66% is less than 70% so so inventor claim is wrong

3 0
3 years ago
A triangular plate with a base 5 ft and altitude 3 ft is submerged vertically in water. If the base is in the surface of water,
Scorpion4ik [409]

Answer:

Hydrostatic force = 41168 N

Explanation:

Complete question

A triangular plate with a base 5 ft and altitude 3 ft is submerged vertically in water  so that the top is 4 ft below the surface. If the base is in the surface of water, find the force against onr side of the plate. Express the hydrostatic force against one side of the plate as an integral and evaluate it. (Recall that the weight density of water is 62.5 lb/ft3.)

Let "x" be the side length submerged in water.

Then

w(x)/base = (4+3-x)/altitude

w(x)/5 = (4+3-x)/3

w(x) = 5* (7-x)/3

Hydrostatic force = 62.5 integration of  x * 4 * (10-x)/3 with limits from 4 to 7

HF = integration of 40x - 4x^2/3

HF = 20x^2 - 4x^3/9 with limit 4 to 7

HF = (20*7^2 - 4*7^(3/9))- (20*4^2 - 4*4^(3/9))

HF = 658.69 N *62.5 = 41168 N

4 0
3 years ago
Other questions:
  • Thermoplastics burn upon heating. a)-True b)- false?
    14·1 answer
  • A well-insulated tank in a vapor power plant operates at steady state. Saturated liquid water enters at inlet 1 at a rate of 125
    6·2 answers
  • An AC sine wave has an effective value of 100V what’s the peak value of the waveform
    6·1 answer
  • Write a program that prompts the user to enter two characters and display the corresponding major and year status. The first cha
    7·1 answer
  • Matthew wants to manufacture a large quantity of products with standardized products having less variety. Which type of producti
    5·1 answer
  • Given a series of numbers as input, add them up until the input is 10 and print the total. Do not add the final 10. For example,
    7·1 answer
  • The heat transfer rate per unit area in a thermal circuit is equivalent to what quantity in an electric circuit? A. voltage B. c
    6·1 answer
  • A front wheel drive vehicle with four wheel disc brakes is pulling to the left. Tech A says an external kink or internal restric
    13·1 answer
  • A) If a given directional antenna can receive 15 times the power of an isotropic antenna, what is
    11·1 answer
  • I) A sag vertical curve is to be designed to join a 4% grade to a 2% grade. If the design
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!