. can you help me modify my code? the output should be: Enter the word: CodeChum There is a vowel in the word "CodeChum"   source code: #include int main() {     // declaring the character array     char word[100];     // taking user input of the word     printf("Enter the word: ");     scanf("%s", word);     // calling the hasVowel() function and passing the word with it     // storing the returned value in a variable result     int result = hasVowel(word);     // if the result returned is 1     if(result == 1)      {         printf("There is a vowel in the word \"%s\"", word);     }           // if the result returned is 0     else if(result == 0)      {         printf("There is no vowel in the word \"%s\"", word);     }          return 0; }   2. it says that it is wrong but when I run the program the output is okay, I don't know what's wrong: source code:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

1. can you help me modify my code? the output should be:

Enter the word: CodeChum

There is a vowel in the word "CodeChum"

 

source code:

#include<stdio.h>
int main()
{
    // declaring the character array
    char word[100];

    // taking user input of the word
    printf("Enter the word: ");
    scanf("%s", word);

    // calling the hasVowel() function and passing the word with it
    // storing the returned value in a variable result
    int result = hasVowel(word);

    // if the result returned is 1
    if(result == 1) 
    {
        printf("There is a vowel in the word \"%s\"", word);
    } 
    
    // if the result returned is 0
    else if(result == 0) 
    {
        printf("There is no vowel in the word \"%s\"", word);
    }
    
    return 0;
}

 

2. it says that it is wrong but when I run the program the output is okay, I don't know what's wrong:

source code:

 

"Only if you can determine if there is a vowel in a certain word"
main.c
1 #include<stdio.h>
2 int nain)
3- {
Shucks! It's always better to be prepared. Who knows that might indeed
happen. I'm going to need your help to create function that'll do this so
// declaring the character array
char word [100];
4
tomorrow, I will just call this function.
6
// taking user input of the word
printf("Enter the word: ");
scanf("%s", word);
7
Instructions:
8
9
1. In the code editor, you are provided a main() function that asks the
10
// calling the hasVowel) function and passing the word with it
// storing the returned value in a variable result
int result = hasVowel(word);
user for a word. This word is then passed to a function called,
11
hasVowel().
12
13
2. Your task is to define the hasVowel() function which has the following
14
details
// if the result returned is 1
if(result == 1)
{
printf("There is a vowel in the word "%s\"", word);
}
15
1. Return type - int
16
2. Name - hasVowel
17 -
3. Parameter:
18
1. char* - to hold the character array
19
20
4. Return value - 1 if there is at least 1 vowel and O if there is none.
// if the result returned is 0
else if(result = 0)
{
printf("There is no vowel in the word \"%s\"", word);
21
Be sure to consider both the capital and small letter vowels when
22
checking.
23 -
24
25
Input
26
27
return 0;
1. The word
28 }
29
<>
CodeChum Terminal
30
Output
main.c: In function 'main' :
main.c:13:18: warning: implicit declaration of function 'hasowel' [-Wimplicit-function-declaration]
13 |
int result = hasVowel (word) ;
Enter the word: Codechum
There is a vowel in the word "Codechum"
...
Transcribed Image Text:"Only if you can determine if there is a vowel in a certain word" main.c 1 #include<stdio.h> 2 int nain) 3- { Shucks! It's always better to be prepared. Who knows that might indeed happen. I'm going to need your help to create function that'll do this so // declaring the character array char word [100]; 4 tomorrow, I will just call this function. 6 // taking user input of the word printf("Enter the word: "); scanf("%s", word); 7 Instructions: 8 9 1. In the code editor, you are provided a main() function that asks the 10 // calling the hasVowel) function and passing the word with it // storing the returned value in a variable result int result = hasVowel(word); user for a word. This word is then passed to a function called, 11 hasVowel(). 12 13 2. Your task is to define the hasVowel() function which has the following 14 details // if the result returned is 1 if(result == 1) { printf("There is a vowel in the word "%s\"", word); } 15 1. Return type - int 16 2. Name - hasVowel 17 - 3. Parameter: 18 1. char* - to hold the character array 19 20 4. Return value - 1 if there is at least 1 vowel and O if there is none. // if the result returned is 0 else if(result = 0) { printf("There is no vowel in the word \"%s\"", word); 21 Be sure to consider both the capital and small letter vowels when 22 checking. 23 - 24 25 Input 26 27 return 0; 1. The word 28 } 29 <> CodeChum Terminal 30 Output main.c: In function 'main' : main.c:13:18: warning: implicit declaration of function 'hasowel' [-Wimplicit-function-declaration] 13 | int result = hasVowel (word) ; Enter the word: Codechum There is a vowel in the word "Codechum" ...
Can you help me find the ring that she wants?
< >
Test Cases
main.c
1 #include <stdio.h>
int findRing (int rings 0, intn, int wantedRing)
3- {int index=0;
2
Instructions:
E Run Tests
for Çint i-0;i<n;i++)
{
if(rings [i]=wantedRing)//Performing a linear search to find the wanted ring
1. In the code editor, you are provided with the main() function that asks
4
5-
the user for 10 elements that represents the options for the ring as well
as a single integer value that represents the ring that she wants. Then,
a call to the findRing() function is made and the array of rings and the
6
Test Case 1
7-
8
index=i;
ring she wants are passed into it.
Your Output
}
}
9
2. Your task is to implement the findRing() function. This has the following
details:
10
return index;
Enter option #1:
Enter option #2:
11
1. Return type - int
2. Name - findRing
12 }
13 - int main) {
Enter option #3:
:
Enter option #4:
3. Parameters
14
int rings [10];
1. int* - for the array of rings
15
Enter option #5:
for Çint i = 0; i <10; i++) {
printf("Enter option #%d: ", i + 1);
scanf("%d", &rings [i]):
}
16 -
2. int - size of the array of rings
Enter option #6:
17
3. int - the ring that she wants
Enter option #7:
18
4. Return value - the index of the ring in the array of rings. It is
guaranteed that there is only one such ring that matches the ring
that she wants.
Enter option #S:
19
20
Enter option #9:
21
Enter option #10:
int wantedRing;
printf("Enter the ring she wants: ");
scanf("%d", &wantedRing);
22
Enter the ring sh
23
Input
24
Ring 25 found at
25
printf("\nRing %d found at option %d!", wantedRing, findRing (rings, 10, wantedRing) + 1);
1. Ten integer values representing the rings
26
27
return 0;
2. Integer value representing the ring she wants
28
Expected Output
29 }
Output
Enter option #1:
Enter option #2:
Enter option #3:
Enter option #1: 5
Enter option #4:
Enter option #5:
Enter option #2: 3
Enter option #3: 10
Enter
Enter option #6:
Enter option #4: 9
Enter option #5: 13
Enter option #7:
Enter option #6: 11
Enter option #7: 20
Enter option #8:
Enter option #9:
Enter option #10:
Transcribed Image Text:Can you help me find the ring that she wants? < > Test Cases main.c 1 #include <stdio.h> int findRing (int rings 0, intn, int wantedRing) 3- {int index=0; 2 Instructions: E Run Tests for Çint i-0;i<n;i++) { if(rings [i]=wantedRing)//Performing a linear search to find the wanted ring 1. In the code editor, you are provided with the main() function that asks 4 5- the user for 10 elements that represents the options for the ring as well as a single integer value that represents the ring that she wants. Then, a call to the findRing() function is made and the array of rings and the 6 Test Case 1 7- 8 index=i; ring she wants are passed into it. Your Output } } 9 2. Your task is to implement the findRing() function. This has the following details: 10 return index; Enter option #1: Enter option #2: 11 1. Return type - int 2. Name - findRing 12 } 13 - int main) { Enter option #3: : Enter option #4: 3. Parameters 14 int rings [10]; 1. int* - for the array of rings 15 Enter option #5: for Çint i = 0; i <10; i++) { printf("Enter option #%d: ", i + 1); scanf("%d", &rings [i]): } 16 - 2. int - size of the array of rings Enter option #6: 17 3. int - the ring that she wants Enter option #7: 18 4. Return value - the index of the ring in the array of rings. It is guaranteed that there is only one such ring that matches the ring that she wants. Enter option #S: 19 20 Enter option #9: 21 Enter option #10: int wantedRing; printf("Enter the ring she wants: "); scanf("%d", &wantedRing); 22 Enter the ring sh 23 Input 24 Ring 25 found at 25 printf("\nRing %d found at option %d!", wantedRing, findRing (rings, 10, wantedRing) + 1); 1. Ten integer values representing the rings 26 27 return 0; 2. Integer value representing the ring she wants 28 Expected Output 29 } Output Enter option #1: Enter option #2: Enter option #3: Enter option #1: 5 Enter option #4: Enter option #5: Enter option #2: 3 Enter option #3: 10 Enter Enter option #6: Enter option #4: 9 Enter option #5: 13 Enter option #7: Enter option #6: 11 Enter option #7: 20 Enter option #8: Enter option #9: Enter option #10:
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY