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
Plz help electrical technology
oksano4ka [1.4K]

Answer:

OPTION A,Larger

HOPE IT HELPS

8 0
3 years ago
Read 2 more answers
Why is tubing sometimes coiled when installed in a car or vechile
andriy [413]

Answer:

Coiled tubing is often used to carry out operations similar to wire lining.

8 0
3 years ago
For methyl chloride at 100°C the second and third virial coefficients are: B = −242.5 cm 3 ·mol −1 C = 25,200 cm 6 ·mol −2 Calcu
bogdanovich [222]

Answer:

a)W=12.62 kJ/mol

b)W=12.59 kJ/mol

Explanation:

At T = 100 °C the second and third virial coefficients are

B = -242.5 cm^3 mol^-1

C = 25200 cm^6  mo1^-2

Now according isothermal work of one mole methyl gas is

W=-\int\limits^a_b {P} \, dV

a=v_2\\

b=v_1

from virial equation  

\frac{PV}{RT}=z=1+\frac{B}{V}+\frac{C}{V^2}\\   \\P=RT(1+\frac{B}{V} +\frac{C}{V^2})\frac{1}{V}\\

And  

W=-\int\limits^a_b {RT(1+\frac{B}{V} +\frac{C}{V^2}\frac{1}{V}  } \, dV

a=v_2\\

b=v_1

Now calculate V1 and V2 at given condition

\frac{P1V1}{RT} = 1+\frac{B}{v_1} +\frac{C}{v_1^2}

Substitute given values P_1\\ = 1 x 10^5 , T = 373.15 and given values of coefficients we get  

10^5(v_1)/8.314*373.15=1-242.5/v_1+25200/v_1^2

Solve for V1 by iterative or alternative cubic equation solver we get

v_1=30780 cm^3/mol

Similarly solve for state 2 at P2 = 50 bar we get  

v_1=241.33 cm^3/mol

Now  

W=-\int\limits^a_b {RT(1+\frac{B}{V} +\frac{C}{V^2}\frac{1}{V}  } \, dV

a=241.33

b=30780

After performing integration we get work done on the system is  

W=12.62 kJ/mol

(b) for Z = 1 + B' P +C' P^2 = PV/RT by performing differential we get  

         dV=RT(-1/p^2+0+C')dP

Hence work done on the system is  

W=-\int\limits^a_b {P(RT(-1/p^2+0+C')} \, dP

a=v_2\\

b=v_1

by substituting given limit and P = 1 bar , P2 = 50 bar and T = 373 K we get work  

W=12.59 kJ/mol

The work by differ between a and b because the conversion of constant of virial coefficients are valid only for infinite series  

8 0
3 years ago
Who plays blox burg???
xeze [42]

Answer:

I don't have robux

Explanation:

but i love adopt me

7 0
3 years ago
Read 2 more answers
A hydraulic jump is induced in an 80 ft wide channel.The water depths on either side of the jump are 1 ft and 10 ft.Please calcu
krek1111 [17]

Answer:

a) 42.08 ft/sec

b) 3366.33 ft³/sec

c) 0.235

d) 18.225 ft

e) 3.80 ft

Explanation:

Given:

b = 80ft

y1 = 1 ft

y2 = 10ft

a) Let's take the formula:

\frac{y2}{y1} = \frac{1}{5} * \sqrt{1 + 8f^2 - 1}

10*2 = \sqrt{1 + 8f^2 - 1

1 + 8f² = (20+1)²

= 8f² = 440

f² = 55

f = 7.416

For velocity of the faster moving flow, we have :

\frac{V_1}{\sqrt{g*y_1}} = 7.416

V_1 = 7.416 *\sqrt{32.2*1}

V1 = 42.08 ft/sec

b) the flow rate will be calculated as

Q = VA

VA = V1 * b *y1

= 42.08 * 80 * 1

= 3366.66 ft³/sec

c) The Froude number of the sub-critical flow.

V2.A2 = 3366.66

Where A2 = 80ft * 10ft

Solving for V2, we have:

V_2 = \frac{3666.66}{80*10}

= 4.208 ft/sec

Froude number, F2 =

\frac{V_2}{g*y_2} = \frac{4.208}{32.2*10}

F2 = 0.235

d) El = \frac{(y_2 - y_1)^3}{4*y_1*y_2}

El = \frac{(10-1)^3}{4*1*10}

= \frac{9^3}{40}

= 18.225ft

e) for critical depth, we use :

y_c = [\frac{(\frac{3366.66}{80})^2}{32.2}]^1^/^3

= 3.80 ft

7 0
3 years ago
Read 2 more answers
Other questions:
  • This is a new technology meant to reduce vehicle roll-overs A. Lane-departure warning B. Anti-lock brakes C. Inspection reports
    7·1 answer
  • The kinetic energy correction factor depends on the (shape — volume - mass) of the cross section Of the pipe and the (velocity —
    11·1 answer
  • Classify the terms as related to a thermal system or mechanical system.
    8·1 answer
  • What is the maximum value of the bending stress at the critical cross-section?
    14·1 answer
  • Name the ferrous metal that most workshop tools are made from??
    12·2 answers
  • Please choose a specific type of stability or control surface (e.g., a canard) and explain how it is used, what it is used for,
    5·1 answer
  • If a tapered roller bearing is adjusted to loose, the bearing will bind and overheat.
    11·1 answer
  • a coiled spring is stretched 31.50 cm by a 2.00N weight. How far is it stretched by a 10.00 N weight?
    6·1 answer
  • A 1020 Cold-Drawn steel shaft is to transmit 20 hp while rotating at 1750 rpm. Calculate the transmitted torque in lbs. in. Igno
    6·1 answer
  • What is the law of physics<br><br><br> 10 points if you tell me the answer and your name
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!