C++ :: Program To Search Soccer Players Data To Check Whether Name Supplied By User Is On That List

Oct 29, 2014

Write a program that will search soccer players data to check whether a name supplied by the user is on that list. For doing the search, the user may provide either the player’s full last name or one or more starting letters of the last name. If a matching last name is found, the program will display the player’s full name and date of birth. Otherwise, it will display “Not found”.

Requirements specification:At the start, the program will ask the user to enter information about 10 soccer players constituting soccer player data. Each soccer player data will consist of the following fields:

Last name
First name
Birth month
Birth day
Birth year

The user will be asked to enter each soccer player data on a separate line with the field values separated by a space.

Once the data is entered, the program will display a menu of choices as below:

Chose an option:

(1 – input data, 2 – display original data, 3 – sort data , 4 – display sorted data 5 – search by last name 6 – exit the program )

If the user chooses option 1, the program will ask the user for a data and populate the array of structures that will hold the data for each of the soccer players.

If the user chooses option 2, the program will display data in the order provided by the user (original data).

If use chooses option 3, the program will sort data by last name.

If user chooses number 4 the program will display the data sorted by last name.

If the user chooses option 5, the program will ask the user to enter one or more starting letters of the soccer player’s last name. It will then search the soccer player data for the matching last name. If a match is found, it will display the first player found with the matching pattern. If a match is not found, the program will display “Not found”. If the user enters two forward slashes (//) for the last name, it will no longer search for the name. Instead it will display the main option menu.

If the user chooses option 6, the program will display “Thank you for using this program” and will end.

Why my program isint executing correctly. Here is what i've so far . . . .

#include <iostream>
#include <string>
using namespace std;
struct data {
string lname;
string fname;
int birthmonth;
int birthday;
int birthyear;

[Code]...

View 3 Replies


ADVERTISEMENT

C :: Create A Basic Soccer Points Projection Program

Nov 12, 2014

I'm basically trying to create a program that will project a soccer teams points for the whole season. Here are the basics:

Total games: 38
Win: 3 pts
Draw: 1 pt
Loss: 0 pts

My program compiles fine, but inevitably crashes right before the if statement..

Code:

#include<stdio.h>
int main(void)
{
float ppg, games_played, games_left, points_earned, pts_proj;
char team_one;
}

[code]....

View 4 Replies View Related

C++ :: Search The Data In The Linked List?

Aug 6, 2014

How can I search the data? I want to get the output like this.

============================== Enter a data to search: 44 DATA FOUND! ==============================

Code:
#include <iostream>
using namespace std;
struct node {

[Code].....

View 1 Replies View Related

C++ :: Program To Check If User Presses Power Button On Computer

Jun 19, 2014

How you can make a c++ program that checks to see if the user presses the power button on their computer? And if so, how?

View 1 Replies View Related

C++ :: How To Check For Data Type When Input Value Into Program

Apr 11, 2013

How would I check for proper data type when someone is to input a value into the program? Ex:

int i;
string a;
cout << "Enter a number: ";
cin >> i;
cout >> "Enter a string: ";
cin >> a;

How would you check to make sure that int i would be an actual number and not a letter like "a"?

View 4 Replies View Related

C :: Snakes And Ladder Program - Dice Function To Switch Between Players

Mar 25, 2013

I am writing a snakes and ladder program and I'm almost finished, but I am struggling with the dice to work in the way I want it to work. I want the dice to work like this :

Before each player throw the dice they must start at 0.
Each player must throw a 6 on the dice to move on the board.
If a player threw a 6 on the dice, that player can throw again.

But I ended up with two seperate dice, one for each player (game is only for two players).And when I run the program, both players don't start at 0. And when I throw the dice, both players move at the same time but with different values.

If one of my players threw a 6, they just keep on throwing until someone wins the game. I tried to use a switch and if statements but I couldn't get it right. And so I did this :

Code:
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#define SpaceBar 32// 32 is an ASCII value for a spacebar

[Code] ....

View 5 Replies View Related

C++ :: How To Access Excel File From A Program - Search It For Data And Return Info

Nov 12, 2014

I have been asked to create a program that accesses an inventory file done in excel, look for a alpha-numeric code, which will be inputed by the user, and return to the user informations related to the position of that code, and informations related to the header of the column in which the code resides.

An example of the function I need the program to perform would be:

User inputs: 1429-R1

And the program returns: Marco's 6A, 8/21/2014, 3/7/2014.

using the following example of file:

Marco's 6A
Assessment 8/21/14 3/7/14
1584-R1 1584-R1 1584-R1
1461-2R1 1461-2R1 1461-2R1
1429-R1 1429-R1 1429-R1

View 1 Replies View Related

C++ :: Input Data Of Object From User And Then Insert It In Linked List

May 16, 2013

Error:
--------------------Configuration: nc - Win32 Debug--------------------
Compiling...
cv.cpp
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/nc.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

nc.exe - 2 error(s), 0 warning(s)

Compiles with 0 error but on running 2 Errors appear.

I'm Inputting data of an object from user and then inserting it in the link list.

#include <iostream>
//#include <fstream>
using namespace std;
#define LEN 100
////////////////////////////////////////////////////////////////////////////////////////////////////
class employee{

[Code] ....

View 1 Replies View Related

C++ :: Sort Players In Descending Order On The Basis Of Score - Program Not Working Properly

Feb 11, 2015

#include <iostream.h>
#include <stdlib.h>
#include <time.h>
using namespace std;

class Player {
private:
char name[20];
int score;

[Code] .....

View 5 Replies View Related

C++ :: Program That Takes Baseball Players Statistics And Display Averages - Function Division

Oct 10, 2013

I was required to write a program that takes a baseball players statistics and displays there averages. I was required to make 3 function in the file to perform this tasks. my problem I am having a division problem in the SLG function. My compiler does not require the system ("PAUSE"); command.

OUTPUT
The player's batting average is: 0.347
The player's on-base percentage is: 0.375
The player's slugging percentage is:
(test)AB = 101
(test)Tot Base = 58
0.000

Code:
/* Batting Average Program
file: batavg1CPP.cpp
Glossary of abbreviations:
BA = batting average
PA = plate appearances
H = hits
BB = bases on balls (walks)

[Code] ....

View 3 Replies View Related

C++ :: Check If Binary Search Tree Is Full Or Not Recursively?

Dec 5, 2013

How would I check if a binary search tree is full or not recursively?? ?

View 1 Replies View Related

C :: Program That Allows A User To List All Create New Items

Dec 30, 2013

i want to create a program that allows a user to list all create new items, list those items, delete an item, modify an item, search for an item how can i do that This is my work so far

Code:

#include <stdio.h>
#include <string.h>
struct listofitems
char itemName [50];
float itemPrice = 0;
}

[code]...

View 1 Replies View Related

C++ :: Print PDF (with PrintSilentPages Supplied By Acrobat SDK)

Aug 28, 2012

Why my code below does not print. I am using C++ 6.0 and all I want to do is print a PDF (with PrintSilentPages supplied by Acrobat SDK) that I have stored on my computer. The code compiles fine and seems like it should work but nothing prints. I have researched this extensively without success.

Additional information:

I am on a Windows 7 64-bit machine (don't believe this matters)
I am using Adobe Acrobat SDK X
Have Adobe Reader X 10.1.4 installed

I am able to get this to work by using a Shell Command but for my scenario I need to do this through the SDK.

I have also tried this with Acrobat 9 SDK.

Code:

COleException e;
CAcroAVDoc * pAcroAvDoc = new CAcroAVDoc();
pAcroAvDoc->CreateDispatch(TEXT("AcroExch.AVDoc"), &e);
CString strPathName = "C:ArtaworkPDF";
CString strFileName = "ExamplePDF.pdf";

pAcroAvDoc->Open(strPathName, strFileName);
pAcroAvDoc->PrintPagesSilent(0, 2, 1, 1, 1);
pAcroAvDoc->Close(1);

View 2 Replies View Related

C++ :: Write Program Where User Will Keep Entering Data Until Pressing Ctrl D

Mar 1, 2013

I'm trying to write a program where the user will keep entering data until pressing control + D. Then the it will display the mean, smallest number, and largest number.

Here are three samples of my program running.

Sample 1
Enter the price for stock 1: $ 10
Enter the price for stock 2: $ 1.555
Enter the price for stock 3: $ 3.648

[Code].....

As you can see in Sample 1, the program runs correctly. The largest number was 20 and the lowest number was 1.555. But in Sample 2, the program shows min as 15.500, where it should be showing 15.000 and Sample 3, the program shows min as 110.000 when it should be showing 55.564.

Here's the code.

#include <iostream>
#include <iomanip>
using namespace std;

[Code].....

View 5 Replies View Related

C++ :: Creating Binary Tree Program - Allow User To Input Data Types

Apr 23, 2013

In class we were asked to create a C++ BTree program that would allow a user to input the following data types and then store said data in a .txt file:

0. ID 8 bytes

1. First name 30 char

2. Last Name 30 char

3. Street Address one 30 char

4. Street Adress two 30 char

5. City 30 char

6. State 20 char

7. Zip 10 char

8. Country 30 char

(I'm not particularly asking for full code, pseudo code would also be great). I had a great deal of my work done, unfortunately, the computer I was working on crashed, corrupting my files.

View 4 Replies View Related

C++ :: Loop To Read In Data And Check Data

Oct 8, 2013

struct receivers
{string fname, lname, team,;
int receptions, yards, TDs, longest,rec20, fumbles, yac, firstdown;
double, averagepergain, averageperrec
}

View 2 Replies View Related

C :: Generate A Program That Will Allow User To Enter Data For A Stock And Calculate Amount Of Stocks

Oct 5, 2013

Okay, so my assignment for my C class is to generate a program that will allow the user to enter data for a stock and calculate the amount of stocks that ended up being positive, negative, and neutral.I tried to do this using one stock, here is my code;

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

Code:

void main()
{
float Neg;
float incst;
float shrs;
float bpps;
float crnt;
float crntcst;
float yrfes;
float pft;
float tpft;
}

[code]....

View 6 Replies View Related

C++ :: How To Check User Selection (yes / No) On Message Box

Feb 10, 2013

How can you tell what button(yes/no) on a message box is clicked? Below is what I have right now but I am getting errors.

if (MessageBox(NULL,"The Message", "The Title", MB_YESNO) == IDYES){
do something
}

View 7 Replies View Related

C++ :: How To Improve Validity Check For User Input

Apr 24, 2013

I wonder how can I improve my validity check for user input? I only want them to key in certain range of digit.

Also for my validity check, when I key in character such as ABC, it lead to infinity loop

Here is my code : Code: /*Write a program that can calculate user's age by getting user input their birth date.*/

#include "stdafx.h"
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
int yyyy, mm, dd; //year, month, day
int i = 0; //for the sake of validity check

[Code]...

View 3 Replies View Related

C++ :: Using Char To Check Whether The User Inputs The Right Command?

Mar 20, 2014

I've been trying to finish this airplane seating program I've been working on for a month or two. The problem I have right now is that if the user inputs a number when prompted to enter the column letter he wants, the program goes on to the next step as if the prompt had been answered correctly.

So I originally used string but I heard from Daleth that Char was better, but I don't know how to apply it. I figured out cin.fail, but I've yet to finish this part.

View 2 Replies View Related

C :: Linked List Search

May 7, 2013

I read an article on linked list here: C Linked List Data Structure Explained with an Example C Program

Code:

struct test_struct* search_in_list(int val, struct test_struct **prev)
{
struct test_struct *ptr = head;
struct test_struct *tmp = NULL;
bool found = false;
}

[code].....

What is "if(prev)"? Wouldn't "prev" always have the same value? Secondly, if tmp is NULL (which will be the case when the loop if(ptr->val == val) finds a match the first time it is run), is *prev assigned a NULL?

View 1 Replies View Related

C++ :: Formatting User Input And Check How Many Words Are In String

Feb 5, 2013

I'm trying to write a short program that takes the input from a user and trims any leading/trailing white space, and then checks how many words are in the string. Problem is, I'm only allowed to use stdio.h and stdlib.h. How can I accomplish this? Also, how would I check if any of the characters which were entered aren't either a number, letter, or '-'?

View 3 Replies View Related

C++ :: How To Error Check If User Input Is Letters And Not Numbers

Jun 9, 2014

How do I error check if the user is inputting letters and not numbers? For example, if the user inputs "Lab.txt" I need to display an error message. If they input "Lab2part2.txt" then this is correct and what I want.

I've found a lot of information online on how to error check for numbers or a single letter (EX: 1,2,3, etc. or 'A' 'B' 'C') but nothing for actual WORDS or maybe I should refer to it as a string of characters?

Is there any way to do this? Because my program requires I ask the user to input the name of the file. But the way my code is currently set up is even when the user inputs the wrong file name it still opens the file. I want to prevent this from happening so my thought was to error check user input.

/*Program to determine company's weekly payroll*/

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
void OpenTheFile() {
ifstream inputFile;
string filename;
char letter;
int number;

[Code] .....

View 1 Replies View Related

C/C++ :: Linked List Template Search

Feb 6, 2015

I have a linklist program I've written that seems to work just fine at least, it outputs the right information. However when it comes to the end and says press any key to continue, it crashes when I press a key says debug assertion error rather than just exiting. I haven't gone back and put in comments yet, I know I need to get used to commenting as I go />/>

#ifndef LIST_H
#define LIST_H
#include <iostream>
#include <cstdlib>
using namespace std;
template <class T>
class LinkList {

[Code] ....

Another bit of information. It was working without crashing when I only had the intlist functions called. When I added the doublelist is when I began getting the error however now if I remove the doubelist and go back to just having the intlist calls it still gives the error.

View 9 Replies View Related

C++ :: Search For Element By Name - Printing Linked List

May 2, 2014

I've got this program that I'm working on. Most of the code is from a video tutorial, but I was editing it to be able to search for an element by name. That's working fine, but suddenly the part of the program that prints out all the elements starts in an infinite loop after I input two elements, and search for one.

Here's what I've got:

[code#include <iostream> usingnamespacestd; struct node { int number; string name; node *next; }; bool isEmpty (node *head); char menu (); void insertAsFirstElement (node *&head, node *&last, int number); void insertSorted(node *&head, node *&last, int number); void remove(node *&head, node *&last); void showList (node *current); void showByName (node *current, string name); bool isEmpty (node *head) { if (head == NULL) { return true; } else { returnfalse; } } char menu () { char choice;

[Code] .....

View 8 Replies View Related

C :: Binary Search Tree In Linked List

Feb 25, 2014

Code:

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
struct bst {
int val, level;
struct bst *left, *right, *parent;

[Code]....

The code above is supposed to be a binary search tree. The main outcome for this program is to display the tree in C each time the user inserts or deletes a value.

Since I am a newbie in C programming, I first tried creating a code that would simply display the values in the tree after a user inserts and deletes, before I proceed to displaying the exact tree.

But when I run it the following output shows:

And when I try to insert another value, It won't display anything and won't respond to any keys pressed.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved