Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Determine what does this
#include <stdio.h>
int mystery3( const char *s1, const char *s2 );
int main()
{
char string1[ 80 ];
char string2[ 80 ];
printf( "Enter two strings: " );
scanf( "%s%s", string1 , string2 );
printf( "The result is %d\n", mystery3( string1, string2 ) );
return 0;
}
int mystery3( const char *s1, const char *s2 )
{
for ( ; *s1 != '\0' && *s2 != '\0'; s1++, s2++ ) {
if ( *s1 != *s2 ) {
return 0;
Page 7 of 9
}
}
return 1;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 5 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Please explain Python code # 2) write a procedure that takes a string and # returns it with all its vowels deleted# e.g. Wilkes! would return Wlks!# assume vowels are: aeiou sometimes ydef killvowels(word):vwlss = ""for c in word:# if it is not a vowelif c not in ['a','e','i','o','u']:if c != 'y' or (c == 'y' and random.choice([1,2,3,4]) != 1):vwlss += creturn vwlssdef killvowelsinplace(word):for c in range(len(word)):if word[c] in ['a','e','i','o','u']: # let's ignore yword = word[:c] + word[c+1:] return worddef vowelkiller(word,index):if index < len(word):if word[index] in ['a','e','i','o','u']: # let's ignore yword = word[:index] + word[index+1:] index =- 1 # lost a vowel, so reset indexreturn vowelkiller(word,index+1)return worddef rkillvowelsinplace(word):return vowelkiller(word,0)#rspitoutchars("Wilkes!")print(rkillvowelsinplace("Wilkes!"))print(rkillvowelsinplace("awesome"))print(rkillvowelsinplace("great!"))arrow_forwardpython help Q1: Over or Under Define a procedure over-or-under which takes in a number x and a number y and returns the following: -1 if x is less than y 0 if x is equal to y 1 if x is greater than y *Hint: You can use cond (define (over-or-under x y) 'YOUR-CODE-HERE ) ;;; Tests (over-or-under 1 2) ; expect -1 (over-or-under 2 1) ; expect 1 (over-or-under 1 1) ; expect 0 Q2: Filter Write a procedure filter-lst, which takes a predicate f and a list lst, and returns a new list containing only elements of the list that satisfy the predicate. The output should contain the elements in the same order that they appeared in the original list. (define (filter-lst f lst) 'YOUR-CODE-HERE ) ;;; Tests (define (even? x) (= (modulo x 2) 0)) (filter-lst even? '(0 1 1 2 3 5 8)) ; expect (0 2 8)arrow_forwardComment next to each line of code and write what each line doesarrow_forward
- // SumAndProduct.cpp - This program computes sums and products // Input: Interactive// Output: Computed sum and product #include <iostream>#include <string>void sums(int);void products(int);using namespace std; int main() { int number; cout << "Enter a positive integer or 0 to quit: "; cin >> number; while(number != 0) { // Call sums function here // Call products function here cout << "Enter a positive integer or 0 to quit: "; cin >> number; } return 0;} // End of main function// Write sums function here// Write products function herearrow_forwardConvert this code into c++ please. ASAP NEEEDED #include <stdio.h>int main(){char s[10];int a, b, n;scanf("%d", &n);while(n--){ scanf("%s",s); if(s[0]=='P') printf("skipped\n"); else { sscanf(s, "%d+%d", &a, &b); printf("%d\n", a+b); }}return 0;}arrow_forward// LargeSmall.cpp - This program calculates the largest and smallest of three integer values. #include <iostream> using namespace std; int main() { // This is the work done in the housekeeping() function // Declare and initialize variables here int largest; // Largest of the three values int smallest; // Smallest of the three values // Prompt the user to enter 3 integer values // Write assignment, add conditional statements here as appropriate // This is the work done in the endOfJob() function // Output largest and smallest number. cout << "The largest value is " << largest << endl; cout << "The smallest value is " << smallest << endl; return 0; }arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education