Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 9, Problem 12E
Write a function called s that converts a character string into a floating point value. Have the function accept an optional leading minus sign. So, the call
s
should return the value – 8.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a function that finds the number of occurrences of a specified character in the string using the following header:
int count(const string& s, char a)
For example, count("Welcome", 'e') returns 2. Write a test program that reads a string and a character and displays the number of occurrences of the char- acter in the string.
Use Python
please code in python
Write a function that receives a string as an input and returns the most frequent letter from the given string. Your solution should be case insensitive, so a capital letter (like A) and its non-capital version (a) should be counted as the same letter. In the given string there can be spaces as well, but your solution shouldn’t count spaces. If there are multiple letters with the same occurrence, you can decide which one to return.
Chapter 9 Solutions
Programming in C
Ch. 9 - Type in and run the 11 programs presented in this...Ch. 9 - Prob. 2ECh. 9 - Write a function called s to extract a portion of...Ch. 9 - Write a function called f to determine if one...Ch. 9 - Write a function called r to remove a specified...Ch. 9 - Write a function called i to insert one character...Ch. 9 - Using the f , r , and i functions from preceding...Ch. 9 - Extend the s function from Program 9.11 so that if...Ch. 9 - Write a function called s that converts a...Ch. 9 - If c is a lowercase character, the expression C...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
The following table represents the addresses and contents (using hexadecimal notation) of some cells in a machi...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
State the order of evaluation of the operators in each of the following C statements and show the value of x af...
C How to Program (8th Edition)
Describe the common components needed to create a Web-based application.
Modern Database Management (12th Edition)
Parking Ticket Simulator For this assignment you will design a set of classes that work together to simulate a ...
Starting Out with Java: From Control Structures through Objects (6th Edition)
Identify and correct the errors in each of the following code segments assume that all variables have been prop...
Java How To Program (Early Objects)
Create an application that converts Celsius to Fahrenheit. The formula is F = 1.8 C + 32 where F is the Fahren...
Starting Out With Visual Basic (7th Edition)
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
- Write a program that reads in a line consisting of a students name, Social Security number, user ID, and password. The program outputs the string in which all the digits of the Social Security number and all the characters in the password are replaced by x. (The Social Security number is in the form 000-00-0000, and the user ID and the password do not contain any spaces.) Your program should not use the operator [] to access a string element. Use the appropriate functions described in Table 7-1.arrow_forwardQ5. Write a function called findString to determine if one character string exists inside another string. The first argument to the function should be the character string that is to be searched and the second argument is the string you are interested in finding. If the function finds the specified string, have it return the location in the source string where the string was found. If the function does not find the string, have it return -1. For example: For function, findString ("a chatterbox", "hat") It searches the string "a chatterbox" for the string "hat". Because "hat" does exist inside the source string, the function returns Location= 3 to indicate the starting position inside the source string where "hat" was found. Programming Language :- C Note: You are not allowed to use inbuilt string library functionarrow_forwardUsing Racket: Create a function that takes a string and outputs true if the string’s first three letters start with "ppp" ; ppp-question?arrow_forward
- use c code to Develop a function that gets two same length strings as parameters and reports the number of characters that they have different. For example, if the two strings are Str1: “Hello world! Happy Friday”Str2: “Hello Johny! happy friday” The function should return: Your strings are different in 7 places However, if the strings are exactly equal, it should just say Your strings are the same If the strings are not of the same length, the code should just say: The two strings are not of the same length! Hint: 1.compare the two strings character by character and report the differences 2.answer must have and show the outputarrow_forwardCreate a function that determines whether a string is a valid hex code. A hex code must begin with a pound key # and is exactly 6 characters in length. Each character must be a digit from 0-9 or an alphabetic character from A-F. All alphabetic characters may be uppercase or lowercase. Examples isValidHexCode ("#CD5C5C") → true isValidHexCode("#EAECEE") → true isValidHexCode ("#eaecee") → true isValid HexCode ("#CD5C58C") → false // Length exceeds 6arrow_forwardWrite a function grade2number that takes a student's letter grade (A, B, C, D, F) as a char and returns the corresponding numerical score in the GPA (4.0, 3.0, 2.0, 1.0, 0.0). You should handle the case when the student enters an invalid character (e.g. G) by returning -1.0. Use a switch statement. The function will be called as in the code below. Γράψτε μία συνάρτησης grade2number> που παίρνει τον βαθμό ενός μαθητή ( A, B , C , D, F) ως χαρακτήρα (char) και επιστρέφει την αντίστοιχη αριθμητική βαθμολογία GPA ( 4.0, 3.0, 2.0, 1.0, 0.0 ) . Θα πρέπει να χειριστείτε την περίπτωση που ο μαθητής εισάγει μη έγκυρο χαρακτήρα ( π.χ. G) επιστρέφοντας -1.0 Χρησιμοποιήστε την εντολή switchy. Η συνάρτηση θα καλείται όπως στον παρακάτω κδικα. int main() { char grade; cout > grade; cout << "The GPA score is " << grade2number (grade); return 0;arrow_forward
- This is python programming Create a function based on the following information: You are given two strings with words separated by commas. Try to find what is common between these strings. The words in the same string don't repeat. Your function should find all of the words that appear in both strings. The result must be represented as a string of words separated by commas in alphabetic order. Input: Two arguments as strings. Output: The common words as a string. Return: Nothing is returnedarrow_forwardCreate a function that will test if a string is a valid PIN or not via a regular expression. A valid PIN has: Exactly 4 or 6 characters. Only numeric characters (0-9). • No whitespace. Examples validate("121317") → true validate("1234") → true validate("45135") → false validate("89abc1") → false validate("900876") → true validate(" 4983") falsearrow_forwardWrite a function that receives an integer. The function must return a string containing thehexadecimal representation of the integer.arrow_forward
- Write a function that checks whether two words are anagrams. Two words are anagrams if they contain the same letters in any order. For example, “silent” and “listen” are anagrams. The header of the function is as follows: bool isAnagram(const string& s1, const string& s2) Write a test program that prompts the user to enter two strings and checks whether they are anagrams.arrow_forwardWrite a function called smallestLetter that takes in a string argument and returns a char. The char that is returned by this function is the character in the string with the lowest ASCII integer code. For example: smallestLetter("Hello") returns ‘H’ which is code 72, and smallestLetter("Hello World") returns ' ' (The space character) which is code 32 Please help me with this problem using c++.arrow_forwardHere is the prompt: Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str = "There", then after removing all the vowels, str = "Thr". After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. I need help with my C++ code. My code only produces the correct output some of the time, so I'm not sure where I'm going wrong here. I type a word like 'Baseball' and it outputs 'Bsbll.' So it works great, perfect. BUT then I type something like 'Equation' and it only removes some of the vowels.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Computer Programming for Beginners | Functions, Parameters & Arguments | Ep24; Author: Programming With Avelx;https://www.youtube.com/watch?v=VXlh-qJpfw0;License: Standard YouTube License, CC-BY