C :: Write A Program That Converts Alphanumeric Phone Number Into Numeric Form
Mar 6, 2015
i m learning c programming and i m stuck with this program for some reason.Write a program that converts alphanumeric phone number into numeric form:
O/P:
Enter phone number: CALLAT 2255288
here is the code i have written:
/** compilers shows no error **/
and O/P I get is
Enter phone number: CALLAT
/**blank space***/
int is_phone_number(char* string) This function will take in a string and return 1 if it looks like a phone number 0 otherwise. A phone number takes the form (xxx)-xxx-xxxx where the xs are digits 0-9. So for example (123)-456-7890 is a valid phone number while 123 456-7890 is not.
You should also write a main function that parses a text document and prints out all of the phone numbers found. Hint, look up the strtok function.
Sample input: Please call me at (123)-456-789 sometime tonight.
I had the idea to write a program that would convert a decimal integer into any base up to 36 (there are no letters after that) so I decided to give it a try.
Code: #include <stdio.h> #include <stdlib.h> char letters(int r); // prototypes function for converting 10's to A's and so on, base 11+ will work int main() {
int base; int d; //declares decimal integer int d_clone; // clones d for a loop
I'm having a bit issue with ispunct in my function. The user can input a phone number in any of the formats below:
4147778888 (414)7778888 (414)777-8888
The program will only print out:
41447778888
What I am trying to do is accept any integer and parentheses. If the user inputs anything else, the program will display an error message. Right now, parentheses displays an error which is obvious but I'm wondering if there is a way I can allow a parentheses to be entered but not any other symbol. ex: . , : ; " '
Code: void getPhoneNum(){ // Local Declarations char string[14]; char* tokPtr;
Write a program that reads alphanumeric characters from the keyboard, and computes the average ascii value of the alpha numeric characters, the average alphabetical character, the average numeric character and the average uppercase character. Outputting each, you program should terminate reading once it read a non-alphanumeric character.
Here's what i have so far.
Code: #include <stdio.h> #include <ctype.h> int main(void) { int value = 'a'; int digit_loop = 0; int alpha_loop = 0; int upper_loop = 0;
The basic idea of this exercise is to generate words from a user-input, seven-digit number(a phone number). The code runs, but for some reason, I can't get it to print the numbers into the file.
Code: /*Write a program that will generate a word based on a randomly generated, seven-digit number. there should be 2187 possible words. Avoid "phone numbers" that begin with 0 or 1*/
#include<stdio.h> #define PHONE 7 void wordGenerator(int number[]); void wordGenerator(int number[]) { //loop counters for each digit in the number
And here is the contents of the file: jack 01014 jgd
Moh 02925 Tyeu
When I run it on dev c++, a message appear saying that the prog has stopped working and no output appears. I want to put the name in user[n].name, the phone number in user[n].phoneNumber and the address in user[n].address
I've reached a point in "Jumping into C++" where I need to make a program that converts input numbers into their word equivalent.
So far I've made it work for numbers 0-9999. I've tried implementing 10000-99999 but there are problems with the order of the words printed (57865 would print fifty thousand seven thousand eight hundred sixty five). But besides that, the program is absolutely enormous (for me) and I'm wondering if it can be shortened. Keep in mind I can only use loops and if statements so far. Here it is:
I have an assignment where I need to read in a phone number into any array and I can't use the string data type. Assuming I need to use the getline function, how do I do this? I'm guessing it's with the cstring or .c_str() functions? I don't know.
How we will write a program that will count a number of notes. I mean if i have 5676 rupees and i want to find the number of 5 thousand pak currency ,the number of 1000 notes, the number of 500 notes and the number of 100 notes. How we design such a program of if rlse structure to perform the above task.
So I need to write a program which tells the user if the number they input is prime or not. I have done so and included the code below. My problem is that I need to allow the user to input if they want to enter another number after the first one using y or n and I am having trouble figure it out.
#include <cstdlib> #include <iostream> using namespace std;
Write a program that prompts the user to enter an item#, the program should determine if the item is in the file and print the price of the corresponding item. If the item is not in the file an error message should be printed.
All I have so far is
string item_no=0; cout<<"Enter a item#"; getline(cin,item_no); if stream openData;
I'm trying to code a program in Dev-C++ for auto complete text in a web form. I'm using windows.h and mouse_event() function for move cursor position and click buttons, but I need write in a inputs/textarea a text.
For the program, you will write a utility that converts dollars to coins. It is a simple program that must have the following:
-Multiple outputs to the screen -At least one input -The use of integers and strings -Looking or repetition with Do..While, If..Else -Must have some output text to show correct value of coins that would be converted from the dollars. -Code must include comments explaining your reason for the code section or what the code is doing -Code must compile -Whole dollars only. If value is less than 1 or 0, the program should break or exit. -Turn in your source code (.cpp file) to your instructor with your filename including your first and last name and your compiled executable.
My program takes in an input file from the command line and converts the string from the file into a linked list and then depending on the command it will manipulate the string to either reverse the list, print the list, or take a character out...I'm having trouble taking a character out, my code compiles fine but doesn't change the string at all
I have a non form class. I want to update label/ check status of check box etc.. in non form class ( here resides functions that contains logic). How can i do that ?