Exploit-DB updates

Tuesday, January 25, 2011

Almost done with first C book

Just ordered another book, the one I ordered is "Sams Teach Yourself C in 21 days"
suppose to be intermediate book. Should be able to grind through it pretty quick. Then on too "Advanced C" I forget what author.

Heres were I'm at


#include <cstdlib>
#include <iostream>
#include <conio.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
using namespace std;

main()
{

int ctr;
int idSearch;
int found = 0;

int custID[10] = {313, 453, 502, 101, 892,
475, 792, 912, 343, 633};
float custBal[10] = { 0.00, 45.43, 71.23, 301.56, 9.08,
192.41, 389.00, 229.27, 18.31, 59.54};

int tempID, inner, outer, didSwap;
float tempBal;

for (outer = 0; outer < 9; outer++)
{didSwap = 0;
for (inner = outer; inner < 10; inner++)
{if (custID[inner] < custID[outer])
{tempID = custID[inner];
tempBal = custBal[inner];
custID[inner] = custID[outer];
custBal[inner] = custBal[outer];
custID[outer] = tempID;
custBal[outer] = tempBal;
didSwap = 1;}}
if (didSwap == 0)
{break;}
}
printf("\n***Customer Balance lookup***\n");
printf(" What is your customer ID?");
scanf(" %d", &idSearch);
for (ctr=0; ctr<10; ctr++)
{if (idSearch == custID[ctr])
{found = 1;
break;}
if (custID[ctr] > idSearch)
{break;}
}
if (found)
{ if (custBal[ctr] > 100.00)
{printf("\n That customer balance is %.2f.\n", custBal[ctr]);
printf(" No Credit\n");
}
else
{printf(" The customers Credit is good\n");}
}
else
{ printf("\n **** You must hav typed an incorrect cusomter ID****\n");
printf(" \n Id number %3d was not found in list\n", idSearch);}

system("PAUSE");
return 0;
}


Best song for Grinding applies to grinding in games too is
Wheel in the sky - journey

No comments:

Post a Comment