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.
In C++, write a function isVowel that returns true if a character is a vowel (whether you want to include 'y' as a vowel or not is up to you) and false otherwise. Use this function in a program that asks the user to enter a string of characters and outputs the number of vowels.
in c++:
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.
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_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_forward
- 6. Write a program which reads string and rewrite it in alphabetical order. For example, the word STRING should be written as GINRST. 7. Write a program to replace a particular word by another word in a given string. For example the “PYTHON” should be replaced by “C” in the text “It is good to program in PYTHON language”. 8. Write a program that will find the maximum number from 3 float type numbers. You have to usethe function getMax which will take 3 pointer variables and return the maximum number.arrow_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_forwardThis 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_forward
- Create 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_forwarduse 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_forwardPlease include doctring and write this in python only. Write a function named words_in_both that takes two strings as parameters and returns a set of only those words that appear in both strings. You can assume all characters are letters or spaces. Capitalization shouldn't matter: "to", "To", "tO", and "TO" should all count as the same word. The words in the set should be all lower-case. For example, if one string contains "To", and the other string contains "TO", then the set should contain "to". You can use Python's split() funciton, which breaks up a string into a list of strings. For example: sentence = 'Not the comfy chair!' print(sentence.split()) ['Not', 'the', 'comfy', 'chair!'] Here's one simple example of how words_in_both() might be used: common_words = words_in_both("She is a jack of all trades", 'Jack was tallest of all')arrow_forward
- Create 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_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_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
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