C/C++ :: Adding Two Phone Agendas Together
Apr 4, 2015
I got this problem where I need to create a phone agenda where every name coresponds to a phone number. I decided to create this as a 2 dimensional string array.
But what I do not know how to do is:
I need to create 2 agendas(created in main(ag1 and ag2)) and then add them together to create one big agenda that contains the members of ag1 and ag2.
#include "stdafx.h"
using namespace std;
class Agenda{
string date[20][20];
public:
Agenda();
void afisare();
[Code] ....
View 1 Replies
ADVERTISEMENT
Sep 3, 2014
I'm a student. I've complete an exercise where the goal is to parse some user input to output phone numbers using EXACTLY this style (not including the quotes): "1-888-8888".
Some rules that I've set for my parser are,
1) the phone number can be mixed in with other text, e.g. "My number is 38888888" or "1asdfk8888888" and
2) the first number found must be a valid calling code (1-9).
I wanted the parser to be flexible. Is this nesting too deep?
std::string format_phone_num(std::string &s) {
std::string formatted_num = "";
bool call_code_found = false;
short num_count = 0;
for (unsigned int i = 0; i < s.length(); i++)
[code].....
View 4 Replies
View Related
Jul 14, 2013
I am supposed to make this phone book save to a file and then be able to retrieve it.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct Phonebook_Contacts
{
char FirstName[20];
char LastName[20];
char PhoneNumber[20];
} phone;
}
[code]....
View 4 Replies
View Related
Jun 18, 2013
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;
[Code] ....
View 6 Replies
View Related
Aug 18, 2013
I have made a new Windows Phone App and I would like there to be two versions: one without ads (79p) and one with ads (free). I have sorted out everything expect one issue. I collapse the advert if the app is in the full version but the rest of the page stays the same. How do I move the 'content panel' after the advert is collapsed?
View 1 Replies
View Related
Aug 13, 2013
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
[Code] ....
View 3 Replies
View Related
Mar 6, 2015
Auto lock screen coding for windows phone 8.1.
View 2 Replies
View Related
Sep 11, 2014
Trying to output a .txt file of names emails and phone numbers, but this only outputs the list name: Email.PersonEntry.
private void button1_Click(object sender, EventArgs e) {
DialogResult result;
string fileName;
//Find and Open File
[Code] ....
View 6 Replies
View Related
Nov 4, 2014
I was looking around on the internet and i noticed you could change internet explorer's emulation mode from Desktop to Windows Phone, i was wondering can the same thing be achieved in the C# webbrowser as i know it heavily rely's on IE. I know you can change the standards on the browser through the IE versions but is changing it to Windows Phone Brwoser possible, if so how can i change it?
View 5 Replies
View Related
Nov 28, 2014
I am trying to read the name, phone number and address from a file ... Here is the code but it doesn't work and i don't know where is the problem ...
#include <stdio.h>
#include <stdlib.h>
struct PhoneBook{
char name[50];
int phoneNumber;
char address[50];
[Code] ....
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
View 1 Replies
View Related
Oct 17, 2013
So for class I have to make an array of structures for a basic contact list in a phone.
I understand the bones of the program and how to go about doing most of it but as far as arrays of structures go I am blind.
Code:
struct phone
{
char FirstName[16];
char LastName[16];
int Number[11];
};
struct phone numbers[friends]; //friends is a variable assigned by the user What I am a bit confused about is say the user enters 30 as how many friends they have. How would I assign a value to the 3rd struct for LastName?
View 3 Replies
View Related
Jan 13, 2013
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.
View 4 Replies
View Related
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***/
Code:
#include<stdio.h>
int main(void)
{
char ch;
printf("Enter phone number:");
ch=getchar();
}
[code]....
View 4 Replies
View Related
Apr 21, 2014
You should implement the following function:
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.
Sample output:
Phone number : (123)-456-7890
View 5 Replies
View Related
Nov 16, 2013
I tried to add 2 or more strings together but failed.
eg I would like to add "KK" & "LL" together by adding but it couldn't work.
string string_B = "KK";
string string_C = "LL";
string_A = string_B + string_C;
View 2 Replies
View Related
Jan 14, 2015
Every time I run if(color=="1") it's supposed to add 1 to redTotal. However, every time I run if(color=="1") if get 1 for redTotal every time.
(Write a program that provides the option of tallying up the results of a poll with 3 possible values. The first input to the program is the poll question; the next three inputs are the possible answers. The first answer is indicated by 1, the second by 2, the third by 3. The answers are tallied until a 0 is entered. The program should then show the results of the poll—try making a bar graph that shows the results properly scaled to fit on your screen no matter how many results were entered.)
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
[Code]....
View 4 Replies
View Related
Jul 3, 2014
I am new to c and I have come across a problem when adding other functions to a programme and printing the values. The question I am attempting to solve is :
The following function computes ex by summing the Taylor series expansion to n terms. Write a program to print a table of ex using both this function and the exp() function from the math.h library, for x = 0 to 1 in steps of 0.1. The program should ask the user what value of n to use.
double taylor(double x, int n) {
int i;
double sum = 1.0;
double term = 1.0;
for (i=1; i<=n; i++) {
/*Or we could have written: */
term = term * x / i; /* term *= x / i; */
sum = sum + term; /* sum += term; */
}
return sum;
}
My code is
Code:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
/*Taylor series for e*/
[code]....
code prints out the values for exp, but it gets stuck in the Taylor function and I'm not sure how to solve it.
View 2 Replies
View Related
Nov 19, 2013
So here is what i need i need a way i can add 3 variables one after the other example:
int a = 1;
int b = 2;
int c = 3;
//Here comes my problem
int d = a + b + c;
When I write it like thet d = 6 ,
but I need it to be 123,
View 4 Replies
View Related
Jan 27, 2015
int sum=82;
for(int i; i < sum.length; i++)
{
final=sum[i]+final;
}
I need getting the sum and adding the numbers together. for example 82 would be 8+2. I keep getting an error on this piece of code....
View 5 Replies
View Related
May 21, 2013
How would one add each value from an array? I'm working from a string but I was wondering if there was a way to loop through the string and add each value. This is what I have so far:
#include <iostream>
#include <cmath>
#include <string>
int main() {
std::string numbers;
int sum;
[Code] ....
View 3 Replies
View Related
Feb 5, 2013
I have the following code in sourceFile.cpp. functionA() is first called and inserted entires for key1, key2 and key3. Then functionB() gets called to use the vectors for the 3 keys. I want to free all memory after exiting functionC(). Among the three ways to put an entry into the map for the 3 keys, which is correct / better?
Class ClassA { ... }
ClassA *key1 = new ClassA();
ClassA *key2 = new ClassA();
ClassA *key3 = new ClassA();
[Code]....
View 2 Replies
View Related
May 18, 2014
Currently in development of a cookie clicker clone (for fun)
I am stuck at the idea of the "Cookies Per Second" thing.
Is there a way to implement a per second adder thing that doesnt actually effect the game play (eg even though the player may not be pressing C every second a cookie (or more) will be added, or if they can press C more than once a second, every second a cookie will be added... If you get what I mean).
Code is below if you would like to look />
MAIN.cpp
#include <iostream>
#include <conio.h>
#include <Windows.h>
#include "Shop.h"
#include "Varis mate.h"
[Code] .....
View 3 Replies
View Related
Feb 7, 2012
I need to input values for two arrays and then add the two with all of it being print visible. I have this so far but can not figure out how to add the two arrays.
#include <iostream>
using namespace std;
int main ()
{
{
int const ROWS = 3;
int const COLUMNS = 3;
int square[ROWS][COLUMNS];
[Code] .....
View 7 Replies
View Related
Mar 5, 2014
'm new to programing and I'm trying to get this program to add up a price of coffee to the add on extras such as cinnamon, etc. But once the program runs it doesn't add up the coffee price with the extras and I've been at it for hours...
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
[Code] ......
View 6 Replies
View Related
Mar 3, 2015
This is my code without malloc. I need to change the array size so there is no max size for each matrix. I must dynamically allocate space for all arrays used. So I need to use malloc to create my arrays. So I cant use int A[rows][cols].
Code:
/* This program asks the user for 2 matrices called A and B, as integers, and displays their sum, C. The max dimension of each matrix is 100. */
#include<stdio.h>
// Construct function
void construct()
{
int m, n, i, j;// Variables
int first[100][100], second[100][100], sum[100][100];// Matrices variables
[Code]...
Im having a hard time understanding/using malloc. Should first, second, and sum be single pointers or double? How do I scan the matrix correctly? And how do I add them properly? Do I have to change my for loops?
Code:
/* This program asks the user for 2 matrices called A and B, as integers, and displays their sum, C. The max dimension of each matrix is 100. */
#include <stdio.h>
#include <stdlib.h>
// Construct function
void construct()
[Code]...
View 3 Replies
View Related
Apr 3, 2013
I am currently working on a program and Originally I was to create a bash program to extra information from youtube and create a table of users, views, titles, duration, etc. (I sent each to a txt file)..Then I was to create a C program to use the extracted information. In this case Users and read in the conents of user.txt and construct a linked list to hold the information. Then print from the Linked list.I managed to do that,
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define LINE_LENGTH 100
void build_a_lst(), print_a_line(), print_lst();
void insert_at_end();
}
[code]...
What I have to do now is start reading in The other files and construct a table. And radix sort it by views. But to get to the radix sort part I get stuck on reading in all the files correctly and having the linked list hold them. I keep getting seg faults when I change my code.
View 3 Replies
View Related