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
A ____ is either in the pressure reducer or in the downstream side of the system to ensure that the control air pressure does no
Alika [10]

Answer:

A relief valve is either in the pressure reducer or in the downstream side of the system to ensure that the control air pressure does not exceed about 30 psig.

3 0
2 years ago
1. What did observations between 1912 and 1917 show?_____
valentinak56 [21]

The following set of prompts is astronomy related.

1) It is to be noted that the observations between 1912 and 1917  revealed that the earth was millions of years old and cooled down from a once molten state.

2) Lemaitres argued that the physical world began as a single particle—the "primeval atom," as he termed it—that disintegrated in an explosion, resulting in space and time and the cosmos' ongoing expansion.

3) It is TRUE to state that between 1912 and 1922, astronomer Vesto Slipher at the Lowell Observatory in Arizona uncovered that the spectra of light from many of these celestial entities were systematically shifted to longer wavelengths, or redshifted. The objects referenced here were galaxies in the distance.

4)  The important discovery that Hubble and his assistant discovered about galaxies was that some nebulae were galaxies <u>expanding </u>beyond our own galaxies.

5) It means that the universe has been growing or expanding ever since the Big Bang.

6) By observing very distant objects, scientists can tell whether or not the universe is moving, growing, or shrinking. This concept is referred to as redshift.

7) In 1965, the American Radio Astronomers Arno Penzias and Robert Wilson inadvertently discovered Cosmic Microwave Background Radiation.

8) According to all recent observations and studies, the Universe has no center.

9) It is estimated the Universe is 13.8 Billion Years old.

10) According to the Big Bang Theory, the whole Universe existed within a bubble millions of times smaller than the size of a pinhead. It was hotter and denser than we could have imagined. Then it burst into flames. According to this belief, this explosion produced life as we know it. It should be highlighted that, while the hypothesis has been utilized to explain numerous scientific facts, it is still an unproven theory.

<h3>When did the study of astronomy begin?</h3>

The Assyro-Babylonians made the earliest written records of regular astronomical observations approximately 1000 BCE. Astronomers had built an extensive knowledge of the celestial bodies and documented their periodic movements in Mesopotamia, which is located in the southern section of modern-day Iraq.

Astronomy is the oldest natural science, dating back to antiquity, with roots in prehistoric religious, mythical, cosmological, calendrical, and astrological beliefs and practices: vestiges of these can still be found in astrology, a discipline long intertwined with public and governmental astronomy.

Learn more about astronomy:
brainly.com/question/14375304
#SPJ1

7 0
1 year ago
Compute the number of kilo- grams of hydrogen that pass per hour through a 6-mm-thick sheet of palladium having an area of 0.25
nydimaria [60]

Answer:

The number of kilo- grams of hydrogen that pass per hour through this sheet of palladium is 4.1 * 10^{-3} \frac{kg}{h}

Explanation:

Given

x1 = 0 mm

x2 = 6 mm = 6 * 10^{-3} m

c1 = 2 kg/m^{3}

c2 = 0.4 kg/m^{3}

T = 600 °C

Area = 0.25 m^{2}

D = 1.7 * 10^{8} m^{2}/s

First equation

J = - D \frac{c1 - c2}{x1 - x2}

Second equation

J = \frac{M}{A*t}

To find the J (flux) use the First equation

J = - 1.7 * 10^{8} m^{2}/s * \frac{2 kg/m^{3}  - 0.4 kg/m^{3}}{0 - 6 * 10^{-3} } = 4.53 * 10^{-6} \frac{kg}{m^{2}s }

To find M use the Second equation

4.53 * 10^{-6} \frac{kg}{m^{2}s} = \frac{M}{0.25 m^{2} * 3600s/h}

M = 4.1 * 10^{-3} \frac{kg}{h}

4 0
3 years ago
Oliver is designing a new children’s slide to increase the speed at which a child can descend. His first design involved steel b
AVprozaik [17]

Answer:

The correct option is;

A) Steel becomes too hot in the Sun and can burn the children

Explanation:

The properties of steel includes;

Low specific heat capacity, high thermal and electrical toughness, high hardness, high tensile strength, high yield strength, appreciable elongation, high fatigue strength, can easily corrode, high malleability and ability to creep

Therefore, due to the low specific heat capacity, which is 0.511 J/(g·°C) and high conductivity of steel which is about 32 W/(m·k), the temperature of the steel can rapidly rise and the hot steel surface can readily conduct the heat, (due to the temperature difference) to other bodies that come in contact

8 0
3 years ago
Describe a gear train that would transform a counterclockwise input rotation to a counterclockwise output rotation where the dri
masya89 [10]

Answer:

For a gear train that would train that transform a counterclockwise input into a counterclockwise output such that the gear that is driven rotates three times when the driver rotates once, we have;

1) The number of gears in the gear train = 3 gears with an arrangement such that there is a gear in between the input and the output gear that rotates clockwise for the output gear to rotate counter clockwise

2) The speed ratio of the driven gear to the driver gear = 3

Therefore, we have;

Speed \ Ratio =\dfrac{Speed \ of \ Driven \ Gear}{Speed \ of \ Driver \ Gear} = \dfrac{The \ Number \ of \ Teeth \ of \ Driver \ Gear}{The \ Number \ of \ Teeth \ of \ Driven \ Gear}

Therefore, for a speed ratio of 3, the number of teeth of the driver gear, driving the output gear, must be 3 times, the number of teeth of the driven gear

Explanation:

3 0
3 years ago
Other questions:
  • 11 Notează, în caiet, trăsăturile personajelor ce se pot
    13·1 answer
  • At the end of a power distribution system, a certain feeder supplies three distribution transformer, each one supplying a group
    8·1 answer
  • Which engineers are requried to have a PE (professional engineer) license?
    13·2 answers
  • A common rule of thumb for controller discretization is to have "6 samples per rise time" in order to achieve a reasonable appro
    9·1 answer
  • For the system form of the basic laws, the momentum of a system can change as a result of: a. pressure acting on the system. b.
    14·2 answers
  • This elementary problem begins to explore propagation delayand transmission delay, two central concepts in data networking. Cons
    6·1 answer
  • Different between an architect and an engineer​
    15·1 answer
  • Please answer i dont understand and dont know the answer​
    14·1 answer
  • scrapers are used to haul dirt from a borrow pit to the cap of a landfill. the estimated cycle time for the scrapers is 9.5 minu
    14·1 answer
  • Question 8 (1 point)
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!