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
The wall of drying oven is constructed by sandwiching insulation material of thermal conductivity k = 0.05 W/m°K between thin me
masha68 [24]

Answer:

86 mm

Explanation:

From the attached thermal circuit diagram, equation for i-nodes will be

\frac {T_ \infty, i-T_{i}}{ R^{"}_{cv, i}} + \frac {T_{o}-T_{i}}{ R^{"}_{cd}} + q_{rad} = 0 Equation 1

Similarly, the equation for outer node “o” will be

\frac {T_{ i}-T_{o}}{ R^{"}_{cd}} + \frac {T_{\infty, o} -T_{o}}{ R^{"}_{cv, o}} = 0 Equation 2

The conventive thermal resistance in i-node will be

R^{"}_{cv, i}= \frac {1}{h_{i}}= \frac {1}{30}= 0.033 m^{2}K/w Equation 3

The conventive hermal resistance per unit area is

R^{"}_{cv, o}= \frac {1}{h_{o}}= \frac {1}{10}= 0.100 m^{2}K/w Equation 4

The conductive thermal resistance per unit area is

R^{"}_{cd}= \frac {L}{K}= \frac {L}{0.05} m^{2}K/w Equation 5

Since q_{rad}  is given as 100, T_{o}  is 40 T_ \infty  is 300 T_{\infty, o}  is 25  

Substituting the values in equations 3,4 and 5 into equations 1 and 2 we obtain

\frac {300-T_{i}}{0.033} +\frac {40-T_{i}}{L/0.05} +100=0  Equation 6

\frac {T_{ i}-40}{L/0.05}+ \frac {25-40}{0.100}=0

T_{i}-40= \frac {L}{0.05}*150

T_{i}-40=3000L

T_{i}=3000L+40 Equation 7

From equation 6 we can substitute wherever there’s T_{i} with 3000L+40 as seen in equation 7 hence we obtain

\frac {300- (3000L+40)}{0.033} + \frac {40- (3000L+40)}{L/0.05}+100=0

The above can be simplified to be

\frac {260-3000L}{0.033}+ \frac {(-3000L)}{L/0.05}+100=0

\frac {260-3000L}{0.033}=50

-3000L=1.665-260

L= \frac {-258.33}{-3000}=0.086*10^{-3}m= 86mm

Therefore, insulation thickness is 86mm

8 0
3 years ago
What does drivetrain mean in coding?
Rudik [331]

Answer:

A drivetrain allows a robot to be mobile by using wheels, tank treads, or another method. A drivetrain is sometimes referred to as a drive base. Identifying which kind of drivetrain to use is one of the first considerations when designing a robot.

Explanation:

Hope this helps! Brainliest plz!

4 0
3 years ago
Driving to the city, at one point the vehicle you were in, was moving at 80 mph, how fast is it in km/h?
mars1129 [50]

Answer:

128.74 Km/h

Explanation:

5 0
3 years ago
Read 2 more answers
The team needs to choose a primary view for the part drawing. Three team members make suggestions:
dexar [7]

Answer:

<u>Option 1</u>

Explanation:

As the team has already submitted the plans for the part drawing, the best way to proceed would be how it was given in the plans. Hence, the option to be selected :

  • <u>Team member 1 suggests an orthographic top view because that is how the plans for the part were submitted.</u>
6 0
2 years ago
Draw a circuit diagram of one lamp controlled by one switch and show how insulation resistance test is carried out​
Ganezh [65]

isisksksksjjsjsjsjjsjd

8 0
3 years ago
Other questions:
  • The cables of a power line are copper-coated steel wire. The overall diameter of the wire is 5/8 in. The steel core has a diamet
    8·1 answer
  • A closed system undergoes an adiabatic process during which the work transfer into the system is 12 kJ. The system then returns
    14·1 answer
  • Suppose that H1(s) and H2(s) are two strictly proper singleinput, single-output transfer functions with controllable statespace
    8·1 answer
  • An urn contains r red, w white, and b black balls. Which has higher entropy, drawing k ~2 balls from the urn with replacement or
    7·1 answer
  • In this type of projection, the angles between the three axes are different:- A) Isometric B) Axonometric C) Trimetric D) Dimetn
    11·1 answer
  • a triangle is defined by the three vertices. write the following functions of the triangle class assume that the point class has
    7·1 answer
  • The structure of a house is such that it loses heat at a rate of 5400 kJ/h per degree Cdifference between the indoors and outdoo
    13·1 answer
  • Which option identifies the next step Kristin should take to test the design in the following scenario?
    6·1 answer
  • Compute the theoretical density of ZnS given that the Zn-S distance and bond angle are 0.234 nm and 109.5o, respectively. The at
    6·1 answer
  • Whats the best way to find the load capacity of a crane
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!