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
Who works alongside and assists the engineers?
nika2105 [10]

Answer:

<u>Assistants</u><u> </u><u>works alongside and assists the engineers.</u>

5 0
3 years ago
The maximum stress that a bar will withstand before failing is called • Rapture Strength • Yield Strength • Tensile Strength • B
konstantin123 [22]

Answer: Rupture strength

Explanation: Rupture strength is the strength of a material that is bearable till the point before the breakage by the tensile strength applied on it. This term is mentioned when there is a sort of deformation in the material due to tension.So, rupture will occur before whenever there are chances of failing and the material is still able to bear stresses before failing.  

7 0
3 years ago
vertical gate in an irrigation canal holds back 12.2 m of water. Find the average force on the gate if its width is 3.60 m. Repo
DanielleElmas [232]

Answer:

The right solution is "2625 kN".

Explanation:

According to the question,

The average pressure will be:

= density\times g\times \frac{h}{2}

By putting values, we get

= 1000\times 9.8\times \frac{12.2}{2}

= 1000\times 9.8\times 6.1

= 59780

hence,

The average force will be:

= Pressure\times Area

= 59780\times 3.6\times 12.2

= 2625537 \ N

Or,

= 2625 \ kN

5 0
3 years ago
1. A soil core sampling tube of 4 cm diameter, 12 cm length and initial mass of 0.525 kg (sample only), was dried at 105o C and
belka [17]

Answer:

porosity = 0.07 or 7%

dry bulk density = 3.25g/cm3]

water content =

Explanation:

bulk density = dry Mass / volume of  sample

dry mass = 0.490kg = 490g

volume = πr2h = 3.142 * 2 *2 *12 = 150.8cm3

density = 490/150.8 = 3.25g/cm3

porosity = \frac{wet mass - dry mass }{wet mass} = \frac{0.525 - 0.49}{0.525} = 0.07 or 7%

water content =  \frac{wet mass - dry mass}{wet mass} = 7%

8 0
3 years ago
Read 2 more answers
Describe the medium/long-range transportation options available to people prior
lakkis [162]

Answer:

answer below:

Explanation:

Before the Industrial Revolution, transportation relied on animals (like horses pulling a cart) and boats. Travel was slow and difficult. It could take months to travel across the United States in the early 1800s before industrial revolution

The Industrial Revolution completely changed the way people traveled and how goods were transported.

the problem of traveling upstream was solved during the industrial revolution by the steam engine. in order to make better use of water transportation, canals were build to connect rivers, lakes and oceans. the invention of the railroad and the steam powered locomotive opened up a whole new world in transportation. even with steamboats and railroads, people still needed a better wat to travel between rivers and train stations. a new process called the "macadam " process was used to create smooth gravel roads

I hope this helps a bit.

3 0
3 years ago
Other questions:
  • Where do I buy a 1997 MK4 Toyota Supra twin turbo manual for cheap
    11·1 answer
  • Match each titration term with its definition.
    15·1 answer
  • Give an example of how the fields of science, technology, and mathematics are commonly used when building a highway.
    7·1 answer
  • A light bulb is switched on and within a few minutes its temperature becomes constant. Is it at equilibrium or steady state.
    7·1 answer
  • 12 times the square root of 8737
    13·1 answer
  • Home safety and security is an _________<br><br> process. (7 Letters)<br><br> Answer
    10·1 answer
  • In a wire, when elongation is 4 cm energy stored is E. if it is stretched by 4 cm, then what amount of elastic potential energy
    15·2 answers
  • PLLLLLEEESSSEEE IIII NEED ASAP
    12·2 answers
  • A retail business, owned by share holders and having centralized decision making for their multiple store locations is called:
    13·1 answer
  • a storage tank contains liquid with a density of 0.0361 lbs per cubic inch. the height of liquid in the tank is 168 feet. what i
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!