C++ :: Address Book - Add / View Entries
Sep 3, 2014
This program is an address book where you caan add/view entries. I'm having a problem printing out entries. Why the information isn't getting saved into the structure array?
Code:
#include <iostream>
#include <string>
using namespace std;
struct contactinfo
[Code] .....
View 1 Replies
ADVERTISEMENT
Feb 19, 2014
I have to develop an address book for contacts, and it has to be able to add contacts, delete them, and show them all while implementing dynamic memory allocation. I'm thinking I should be going with an array of structures, but I'm not sure how to handle that in the context of this problem. I realize deleting them will most likely end up just being me using the free function. i'm thinking I should show all the contacts with a for loop, but say u deleted contacts, and those memory spaces were now absent, how would I go about it because the looping structure would be flawed wouldn't it.
View 3 Replies
View Related
Dec 6, 2013
the program is of an address book. the syntax is all fine, and the initial menu of options does show up. but once you punch in the cin, the program just stops.
View 9 Replies
View Related
May 11, 2014
My address book will be simple, and the thing's that I'm expecting to use in it are :
Pointers, Linked Lists
Malloc
Structs
Typedefs
Makefile, header file
Putting functions into different program files
I have started the program trying to create a struct, and getting it working with a couple of entries before going onto user input and splitting it up.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
// Struct type address book. Just a name, a number and a pointer
[Code] .....
I'm a bit lost at this point... My knee jerk thought is to create a for loop, and cycle through the list.
I'm not sure how this would apply to this though? Without using the familiar type of print loop such as :
Code:
for (i = 0; ;i++) {
printf("%i
", array[i];
}
I'm thinking that I need to create a temporary struct that can be used to assign the value of the next struct in the list, and then somehow print from that....
I'll try and write the logic out :
while temp != NULL (The last node value is assigned NULL to show us where the end of the list is)
create a temporary pointer that can be used to keep track of where we are in the list.
print out the current entry name and number
then assign the temp pointer value to the * next of the current struct. So if we are in entry1 the *next should be the address of entry 2.
Print out entry 2 name and number, assign entry 2 next to the temp value.
View 1 Replies
View Related
Jul 22, 2014
I have a program I have been working on where the user selects a date and enters the number of days to be viewed in the Calendar.cshtml view. This input renders another view (Update.cshtml) that contains two date picker boxes, one that should contain the selected date and the second one that should contain the calculated date. I am having an issue getting the date selected in the first view to populate to the first date block on the second view as the default and getting the calculated date to populate the second date block in the Update.cshtml view. In addition given the two dates, I would like to generate a calendar, which is why I chose the date picker approach and setting static dates.
Here is my code:
**CalendarController:**
using System.Web.Mvc;
using VanickCalendarApp.Models;
using System;
namespace VanickCalendarApp.Controllers {
public class CalendarController : Controller {
[Code] .....
View 5 Replies
View Related
Sep 15, 2013
I am trying to make a grade book and using a vector to get the grades. I am getting errors all over and I figured this would happen because this is the first time I ever used vectors.
Code:
#ifndef ___2B__Homework__LetterGrade__
#define ___2B__Homework__LetterGrade__
#include <iostream>
#include <vector>
[Code] .....
View 12 Replies
View Related
Feb 7, 2013
Book database. I use scanf to store book name,author name and year when is book written. Example:
Code:
scanf(" %[^
]",k[i].bookname);
I have problem when i want to printf all books from database with this:
Code:
for(i=0;i<counter;i++){
fscanf(f,"%s %s %d",k[i].bookname,k[i].author,&k[i].year);
printf("
%d %s %s %d",(i+1),k[i].bookname,k[i].author,k[i].year);} Output:
Number Book name Author name Year
1 King John 0
2 William Shakespeare 1590
How can i fix this?
View 4 Replies
View Related
Jan 15, 2015
I'm writing a program that uses the readline() function that comes in the Unix Network Programming book, when I use telnet to connect to my server the function reads the input perfectly displaying the username as the user types it in. However, when using a telnet client called syncterm it accepts the user input but does *not* echo it on the screen and I can't figure out why.
View 3 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
Jan 29, 2013
So I was asked to create a C++ program that will ask the user to input 5 books with the ISBN, Title of the book and author/s. It will ask for 3 authors, if the book has only one author, you should leave "author 2 and author 3" blank and display only one author. Thing is... I'm having a problem with the if else condition at the last part of my program. I cant seem to make it work.
#include <iostream>
#include <cstring>
#define SIZE 5
using namespace std;
int i;
[Code]...
View 9 Replies
View Related
Sep 26, 2014
Basically, say i wanted to sum all the values enter for x. First, i ask the user how many x's there are, then create a "for" loop to ask for x1, x2, x3, .. xn. Then i want to know the cumulative total of x. How would i do this? This is the sample code i have made right now inside of my main function:
Code:
int N;
int I;
int X;
//This is where i ask for how many x's there are//
}
[code]....
View 4 Replies
View Related
Sep 19, 2014
How would I be able to let the user enter multiple heart rates which would all be separate.
Code:
printf("Enter your recorded Heart Rates ");
scanf("%d", &in_rate);
//formulas
if (gender == 'm'){
target = 226 - age;
} else if (gender == 'f'){
[Code]...
View 1 Replies
View Related
Oct 16, 2014
I'm having trouble understanding how to get my phonebook to print out it's entries. If I just have one entry, it will correctly display it but if I have 2 or more, it leaves out chunks of that entry's data.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
[Code].....
View 4 Replies
View Related
Sep 16, 2014
when i declare local variable x and use it in array,the error is occure that use of un assign local variable.
namespace ConsoleApplication11
{class Program
{
static void Main(string[] args)
{
int x;
Console.Write("enter how many entries you want");
[Code]...
View 2 Replies
View Related
Nov 2, 2014
I'm creating a program that holds three arrays one for the persons last name, one for the points scored and one for the player number, now I've got all the arrays and everything done but I'm not sure as to how I'm going to delete an entry for multiple arrays.
static Int32[] ProcessDelete(Int32[] playerNumbers, String[] playerLastName, Int32[] playerPoints, ref Int32 playerCount)
{
Int32[] newArray = new Int32[playerNumbers.Length - 1];
[Code].....
View 2 Replies
View Related
Mar 5, 2015
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
[Code]....
It compiles just fine and it will add new entries and print the entries just fine but when I go to delete an entry it will delete it but it will mess up the one before it.
View 8 Replies
View Related
Dec 29, 2013
is it possible to create a dynamic array with all entries in it equal to 0?
int** adjMatrix;
adjMatrix= new int*[numOfVertices];
for(int i=0; i<numOfVertices; i++){
adjMatrix[i]=new int[numOfVertices];
}
View 1 Replies
View Related
May 19, 2013
How do you set all the entries in an array to 0 or a particular number...
View 3 Replies
View Related
Nov 2, 2014
I have to create a program that holds three arrays one for the persons last name one for the points scored and one for the player number, now i've got all the arrays and things done but i'm confused as to how i'm going to delete an entry so far the options i've got working are create player, list player, update player, retrieve player and exit.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PlayerSystem6 {
class Program {
static void Main(string[] args){
[code].....
View 4 Replies
View Related
Oct 3, 2014
Why multiple entries in combo boxes?
private void Form1_Load(object sender, EventArgs e) {
try {
connection.Open();
OleDbCommand command=new OleDbCommand();
command.Connection=connection;
string query="select * from korisnici,dogadjaji";
[code]...
View 14 Replies
View Related
Apr 21, 2013
Here is my code so far:
Code:
//LINEAR CHAINING OR SEPERATE CHAINING...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX_USERNAME_LEN 15
#define MAX_PASSWORD_LEN 20
[Code] ....
When I compile I get this error:
Code:
simpleauth.c: In function ‘initialize_table’:
simpleauth.c:179:30: error: incompatible types when assigning to type ‘DBEntry’ from type ‘void *’
I am sure its a simple error but I cannot seem to figure out how to set all the entries in the database to NULL. My plan is this:
1. Set all entries to NULL.
2. Check if entry is empty, if empty insert into hash-location, if not increment until empty...
Part 2 seems easy to me, but I cannot set them to empty....
View 3 Replies
View Related
Mar 20, 2014
how to do this? ask the user to input entries of 10x10 array. sort each column into increasing order. print out the array with sorted columns?
View 5 Replies
View Related
Nov 18, 2013
I developed the following heap sort algorithm code, and for some reason anytime it goes above 4100 entries, the algorithm completely crashes. It works perfectly up until that point but I can't see why it would crash?
void heap_from_root(MVector &v, int i, int n) {
int end=n,j=0;
// Identify the lowest root and how many sons it has. If it only has one son, set j=1.
if (n==1) { n = 0; j = 1; }
else if ((n-2) % 2 == 0) { n = (n-2)/2; }
else if ((n-1) % 2 == 0) { n = (n-1)/2; j=1; }
[Code]...
View 6 Replies
View Related
Feb 7, 2015
I am writing a program that deals with 2d arrays. The program inputs the number of rows and columns and asks for the entries. When the program run and compiles it works perfectly until it outputs then it gives me a warning.
Here is my code:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int row1=0,col1=0,i,j;
//int a[row1][col1];
int** a= new int*[row1];
[Code]...
I am learning how to do this before I can move on so it can read a text file of numbers.
Also I am having problems with ////delete [] a[];///// I took it out because it made my code compile and run but when I add it in, it gives me an error:
matrixtesting.cpp|56|error: expected primary-expression before ']' token|
I know this expression is suppose to deallocate the array.
View 7 Replies
View Related
Jul 14, 2013
I have an issue with a database call. I've got a database call that counts the number of entries in the database:
private static Int32 dbCount() {
SqlCommand cmd = new SqlCommand("SELECT COUNT (*) FROM Employees", conn);
conn.Open();
Int32 count = (Int32)cmd.ExecuteScalar();
conn.Close();
return count;
}
Afterwards I'm using this as a check throughout my application:
if (dbCount > 0) {
// do something
}
When I execute this code I'm getting the following error: "Operator '>' cannot be applied to operands of type 'method group' and 'int'"
So I'm guessing it has something to do with the cast of the dbCount-object but I don't understand why as I already stated that the count-object to be an Int32.
View 3 Replies
View Related
Jul 14, 2013
I am trying to create a loop to call in the entries from the text file named Set. The entries of Set.txtare :
1 2 3
2 4 5
and so on .. (64 such combinations)[/CODE]
It basically means the first combination for testing is 1 2 3 and next has to be 2 4 5 and so i have 64 such entries defined in set
My test files are located in D://data// and are named tst_data1 to tst_data64.
I created a loop for test set but its incorrect
Code:
// loop for test samples
char basefilename[] = "D://data//";
char , testFilen[160], numiChar[10];
for (int i=1; i<=64; i++) {
strcpy(basefilenme, "D://data//");
strcat(testfilename, Set[]);
[Code] .....
How can i call the Set .txt and how to define it.
View 1 Replies
View Related