New Perspectives on HTML and CSS
6th Edition
ISBN: 9781111526443
Author: Carey, Patrick
Publisher: Course Technology Ptr
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 1.1, Problem 5QC
What is incorrect about the following code? Suggest a possible revision of the code to correct the error.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
In python
don't import libraries
C
someone help me modify the code please.
Instructions:
In the code editor, you are provided with the main() function that asks 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 ring she wants are passed into it.
Your task is to implement the findRing() function. This has the following details:
Return type - int
Name - findRing
Parameters
int* - for the array of rings
int - size of the array of rings
int - the ring that she wants
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.
Input
1. Ten integer values representing the rings
2. Integer value representing the ring she wants
#include <stdio.h>int findRing(int rings[],int n,int wantedRing){int index=0; for(int i=0;i<n;i++) {…
Chapter 1 Solutions
New Perspectives on HTML and CSS
Ch. 1.1 - Prob. 1QCCh. 1.1 - Prob. 2QCCh. 1.1 - Prob. 3QCCh. 1.1 - Prob. 4QCCh. 1.1 - What is incorrect about the following code?...Ch. 1.1 - Prob. 6QCCh. 1.1 - Prob. 7QCCh. 1.1 - Prob. 8QCCh. 1.1 - Prob. 9QCCh. 1.2 - Prob. 1QC
Ch. 1.2 - Prob. 2QCCh. 1.2 - Prob. 3QCCh. 1.2 - Prob. 4QCCh. 1.2 - Prob. 5QCCh. 1.2 - Prob. 6QCCh. 1.2 - Prob. 7QCCh. 1.2 - Prob. 8QCCh. 1.2 - Prob. 9QCCh. 1.3 - Prob. 1QCCh. 1.3 - Prob. 2QCCh. 1.3 - Prob. 3QCCh. 1.3 - Prob. 4QCCh. 1.3 - Prob. 5QCCh. 1.3 - Prob. 6QCCh. 1.3 - Prob. 7QCCh. 1.3 - Prob. 8QCCh. 1.3 - Prob. 9QCCh. 1 - Prob. 1RACh. 1 - Prob. 2RACh. 1 - Prob. 3RACh. 1 - Prob. 4RACh. 1 - Prob. 5RACh. 1 - Prob. 6RACh. 1 - Prob. 7RACh. 1 - Prob. 8RACh. 1 - Prob. 9RACh. 1 - Prob. 10RACh. 1 - Prob. 11RACh. 1 - Prob. 12RACh. 1 - Prob. 13RACh. 1 - Prob. 14RACh. 1 - Prob. 15RACh. 1 - Prob. 16RACh. 1 - Prob. 17RACh. 1 - Prob. 18RACh. 1 - Prob. 19RACh. 1 - Prob. 20RACh. 1 - Prob. 21RACh. 1 - Prob. 22RACh. 1 - Prob. 23RACh. 1 - Prob. 1CP1Ch. 1 - Prob. 2CP1Ch. 1 - Prob. 3CP1Ch. 1 - Prob. 4CP1Ch. 1 - Prob. 5CP1Ch. 1 - Prob. 6CP1Ch. 1 - Prob. 7CP1Ch. 1 - Prob. 8CP1Ch. 1 - Prob. 9CP1Ch. 1 - Prob. 10CP1Ch. 1 - Prob. 11CP1Ch. 1 - Prob. 12CP1Ch. 1 - Prob. 13CP1Ch. 1 - Prob. 14CP1Ch. 1 - Prob. 15CP1Ch. 1 - Prob. 16CP1Ch. 1 - Prob. 1CP2Ch. 1 - Prob. 2CP2Ch. 1 - Prob. 3CP2Ch. 1 - Prob. 4CP2Ch. 1 - Prob. 5CP2Ch. 1 - Prob. 6CP2Ch. 1 - Prob. 7CP2Ch. 1 - Prob. 8CP2Ch. 1 - Prob. 9CP2Ch. 1 - Prob. 10CP2Ch. 1 - Prob. 11CP2Ch. 1 - Prob. 12CP2Ch. 1 - Prob. 1CP3Ch. 1 - Prob. 2CP3Ch. 1 - Prob. 3CP3Ch. 1 - Prob. 4CP3Ch. 1 - Prob. 5CP3Ch. 1 - Prob. 6CP3Ch. 1 - Prob. 7CP3Ch. 1 - Prob. 8CP3Ch. 1 - Prob. 9CP3Ch. 1 - Prob. 10CP3Ch. 1 - Prob. 11CP3Ch. 1 - Prob. 12CP3Ch. 1 - Prob. 13CP3Ch. 1 - Prob. 14CP3Ch. 1 - Prob. 15CP3Ch. 1 - Prob. 16CP3Ch. 1 - Prob. 17CP3Ch. 1 - Prob. 18CP3Ch. 1 - Prob. 19CP3Ch. 1 - Prob. 20CP3Ch. 1 - Prob. 21CP3Ch. 1 - Prob. 22CP3Ch. 1 - Prob. 23CP3Ch. 1 - Prob. 24CP3Ch. 1 - Prob. 25CP3Ch. 1 - Prob. 26CP3Ch. 1 - Prob. 1CP4Ch. 1 - Prob. 2CP4Ch. 1 - Prob. 3CP4Ch. 1 - Prob. 4CP4Ch. 1 - Prob. 5CP4Ch. 1 - Prob. 6CP4Ch. 1 - Prob. 7CP4
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
- I think you forgot to add the insertion function in the code that you provided. The books still display unsorted.arrow_forwardHere is a Python function. def do_something(lst1, lst2): for element1 in lst1: for element2 in lst2: if element1 >= element2: return False return True What is the overall purpose of this function? a) Return True iff the length of lst2 is less than the length of lst1.b) Return True iff each element in lst1 is less than the element at the same index in lst2.c) Return True iff every element in lst1 is less than every element in lst2.d) Return True iff every element in lst1 is less than the first element in lst2.e) Return True iff every element in lst2 is less than the first element in lst1.arrow_forwardC++ Get a value from the user and using a loop, search for the value in the array. Report all the index locations where it is found Report if it is not found anywhere This is part 4 of an ongoing assignment RandArray which consisted of assigning 20 integers with a random value. I am not sure how to write this out so it matches the output ( in the attached pictures ). I have attached the starter code to this problem as well as my code for part 3 which was correct. Thank you ( STARTER CODE ) #include <iostream>using namespace std; #include <cstdlib> // required for rand() int main(){// Put Part3 code here //Part 4// ask cout << "Enter value to find: ";// look through the array. // If it is found:// print // Found 55 at index 12 // if it is not found after looking at all the elements, // print // 0 is not found in randArray } _______________________________________________________________________ ( PART 3 CODE ) #include <iostream> using…arrow_forward
- PYTHON:Please help me fix my code. It was supposed to ask the user to input an inorder traversal and let them choose whether to enter postorder or preorder, then identify the order of the missing traversal, just like the image below. However, my code can only identify the POSTORDER traversal but not the PREORDER. There is something wrong with my def function on def PreOrderT(). Please help me fix it. Thank you. # Main programinorder_list = []preorder_list = []postorder_list = []n = int(input("How many nodes want to enter? ")) # Methodsdef searchR(arr, x, n): # CHANGED THE NAME OF FUNCTION AS THERE ARE TWO FUNCTION WITH SAME NAME for i in range(n): if (arr[i] == x): return i return -1 def PostOrderT(Ino, preo, n): root = searchR(Ino, preo[0], n) if (root != 0): PostOrderT(Ino, preo[1:n], root) if (root != n - 1): PostOrderT(Ino[root + 1:n], preo[root + 1:n], n - root - 1) print(preo[0], end=" ") # Make new nodeclass…arrow_forwardplease include a picture of the program and the output too and thank you!!!arrow_forwardThis assignment will give you a chance to perform some simple tasks with pointers. The tasks are only loosely related to each other. Start the assignment by copying the code below and pasting it into a .cpp file, then add statements to accomplish each of the tasks listed. Don't delete any of the given code or comments. Some of the tasks will only require a single C++ statement, others will require more than one. No documentation is required for this part of the assignment. /* Type your code after each of the commented instructions below (except that the statements for instructions 11 and 21 should be written where the instructions indicate). I have written the first statement for you. */ #include <iostream> using namespace std; int main() { // 1. Create two integer variables named x and y. int x; // 2. Create an int pointer named p1. // 3. Store the address of x in p1. // 4. Use only p1 (not x) to set the value of x to 99. // 5. Using cout and x (not p1), display the value of x.…arrow_forward
- Modify the selection sort function developed in this chapter so that it accepts a second optional argument, which may be either 'up' or 'down'. If the argu-ment is 'up', sort the data in ascending order. If the argument is 'down', sort the data in descending order. If the argument is missing, the default case is to sort the data in ascending order. (Be sure to handle the case of invalid arguments, and be sure to include the proper help information in your function.) Here is the given function which need to be mofified: function out = ssort(a) nvals = length(a); iptr = ii; for jj = ii+1:nvals if a(jj) < a(iptr) iptr = jj; end end if ii ~= iptr temp = a(ii); a(ii) = a(iptr); a(iptr) = temp; end end out = a;arrow_forwardModify the code to generate the Fibonacci sequence in the following ways, and complete each ofthe tasks using both the for- and while-loop.(a) Change the first two elements to 2 and 2.(b) Change the first two elements to 3 and 2.(c) Change the update rule from summing successive elements to taking differences of successiveelements. For example, the third element is defined as the second element minus the first element, andso on.(d) Change the update rule so that each element is defined as the sum of the three precedingelements. Set the third element as 1 in order to start the process.arrow_forwardIn c++ Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, th backwards End each loop with a newline. Ex If courseGrades (7, 9, 11, 10), print: 7 9 11 10 10 11 9 7 Hint Use two for loops. Second loop starts with i=NUM VALS-1. (Notes) Note: These activities may test code with different test values. This activity will perform two tests, both with a 4-element array (int courseGrades(4) See 'How to Use zyBooks Also note: If the submitted code tries to access an invalid array element, such as courseGrades[9] for a 4-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message 32344345730rity? 2 using namespace std; 3 4 int main() { 5 6 7 8 9 10 11 12 13 14 const int NUM VALS-4; int courseGrades [NUM VALS]; int i; for (i = 0; i > courseGrades[1]; } y Your solution goes here Yarrow_forward
- Q2. You are the class representative and your class advisor always requests your help to prepare the result analysis after each internal assessment. One of the tasks that your class advisor has assigned to you is to find whether a student has scored a 0 in a course.Given the scores of the 'n' students in the class, write a python program to find whether how many students have scored a zero in a course. Use arrays to store the marks of the students and assume that the maximum number of students in a class is 50.oarrow_forwardPlz do it c programming in a basic way as possible and plz (( do it with 1 loop and explen the coods as a comment line))arrow_forwardTask 10 Write a Python program that finds the largest value with its key from a given dictionary. [without using max() function] Note: You do not need to take the dictionaries as an input from the user but your code should work for any given dictionary. Also, you need to handle the quotation marks as a part of the output. Hint: Think of membership operators (in and not in). You can use dictionary functions to get the values. ===== Sample 1: Given: {'sci fi': 12, 'mystery': 15, 'horror: 8, 'mythology": 10, 'young_adult': 4, 'adventure':14} Output: The highest selling book genre is 'mystery' and the number of books sold are 15.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- New Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License