The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled C++ Code
Posted by: DannyBoy | April 24, 2011 @ 12:36am
C++ Code
[
Download
]
#include <iostream> using namespace std; typedef int* IntPtr; int main() { int team_size(0), player_removed(0); cout << "How many players are on the team: "; cin >> team_size; IntPtr team; team = new int[team_size]; cout << "What player do you want to remove (cause he sucks): "; cin >> player_removed; cout << "Enter Values: "; //For ease, just put in 1-10 //Gets the player ID of the players for(int j = 1; j <= team_size; j++) { cin >> team[j]; } //Outputs the original array for(int k = 1; k <= team_size; k++) { cout << team[k] << ' '; } //Bumps each player down, based on where the user requested the removed player be for(int l = player_removed; l <= team_size; l++) { team[l] = team[l+1]; } cout << endl; team_size = team_size - 1; //Since we're only removing 1 player, we can take 1 from the size of the team //Outputs the new array, with the player removed gone for(int m = 1; m <= team_size; m++) { cout << team[m] << ' '; } }
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.17 / 8
172 Votes
http://codebin.yi.org/1237
page generated in 0.01 seconds