Saturday, 26 January 2013

Work Works

1. Work Works

If there is a single secret to selling online, it is to work hard. Hard work is the secret to succeeding in almost anything, but it is especially important on the Web.

It's true what they say: the Web levels the playing field. A high school can make a better Web site than a large industrial company. On a level playing field, how big you are matters less than how hard you work.

There are millions of consumers out there, but lots of other Web sites are competing for their attention. So you can't just build an online store and walk away from it. You have to work hard to draw visitors to your site, work hard to create a site that those visitors want to buy from, and work hard to give those buyers such good service that they and their friends will buy again in the future.

So the bad news is that starting a business on the Internet is just like starting any other business: work, work, work. The good news is that it is a lot cheaper.

The Web gives you something that has never existed before in history: an inexpensive sales channel direct to consumers. Before the Web, if you wanted to sell direct to consumers, you either had to build retail stores or do catalog mailings. In either case the entry fee is hundreds of thousands, if not millions, of dollars.

On the Web, you can sell direct to consumers worldwide for a hundred dollars a month. You have to work hard to exploit this opportunity. But if you are willing to work hard, you don't need a lot of money to get started.


Reposted from http://eglobiotraining.com/resourcespeaker


header photo

C Programming


#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<stdlib.h>

struct inventory{
char productCode[15];
int items;
};

int ctr=0;

int search(inventory product[],char *searchCode)
{
                for(int i=0;i<ctr;i++)
                                if(strnicmp(searchCode,product[i].productCode,20)==0)
                                return i;

                return -1;
}

void add(inventory product[])
{
                char tempCode[15];
                int tag;

                system("cls");
                printf("Enter New Product Code: ");
                gets(tempCode);
                tag=(search(product,tempCode));
                if(tag<0)
                {
                                strcpy(product[ctr].productCode,tempCode);
                                product[ctr].items=0;
                                ctr++;
                                printf("New Product Saved...");
                                getch();
                                getch();
                }
                else
                {
                                printf("Product Code Already Exist!!!");
                                getch();
                }
}

void edit(inventory product[])
{
                char editRecord[15];
                int tagEdit,tag;

                system("cls");
                printf("Enter Product Code that you want to edit: ");
                gets(editRecord);
                tagEdit=(search(product,editRecord));

                if(tagEdit>=0)
                {
                                system("cls");
                                printf("Product: %s\n",product[tagEdit].productCode);
                                printf("Items:   %d\n\n",product[tagEdit].items);

                                printf("Enter New Product Code: ");
                                gets(editRecord);
                                tag=(search(product,editRecord));
                                if(tag<0)
                                {
                                                strcpy(product[tagEdit].productCode,editRecord);
                                                printf("\n\nProduct Updated...");
                                                getch();
                                                getch();
                                }
                                else
                                {
                                                printf("Product Code Already Exist!!!");
                                                getch();
                                }
                }

                else
                {
                                printf("Product Code Do Not Exist!!!");
                                getch();
                }
}

void delContinue(inventory product[],int tagDel)
{
                system("cls");
                if(tagDel==ctr-1)
                {
                                printf("Product: %s\n",product[tagDel].productCode);
                                printf("Items:   %d\n\n",product[tagDel].items);

                                printf("Product Deleted...");
                                ctr--;
                                getch();
                }
                else
                {
                                system("cls");
                                printf("Product: %s\n",product[tagDel].productCode);
                                printf("Items:   %d\n\n",product[tagDel].items);

                                strcpy(product[tagDel].productCode,product[ctr-1].productCode);
                                product[tagDel].items=product[ctr-1].items;

                                printf("Product Deleted...");
                                ctr--;
                                getch();
                }
}

void deleteProduct(inventory product[])
{
                char delRecord[10];
                char choice;
                int tagDel;

                system("cls");
                printf("Enter Product Code that you want to delete: ");
                gets(delRecord);
                tagDel=search(product,delRecord);

                if(tagDel>=0)
                {
                                if(product[tagDel].items>0)
                                {
                                                printf("\n\nProduct Have Items!!!\n");
                                                printf("Do you want to continue? [y][n]: ");
                                                scanf("%c",&choice);
                                                if(choice=='y' || choice=='Y')
                                                {
                                                                delContinue(product,tagDel);
                                                }
                                }
                                else
                                {
                                                delContinue(product,tagDel);
                                }
                }
                else
                {
                                printf("Product Code Do Not Exist!!!");
                                getch();
                }

}

void displayProducts(inventory product[])
{

    int i,j,tempItem;
    char tempCode[15];

    if(ctr>0)
    {
                system("cls");
                printf("Product Code\t\tItems\n");
                printf("--------------------------------\n\n");

                                for(i=0;i<ctr;i++)
                                {
                                                for(j=i;j<ctr;j++)
                                                {
                                                                if(strcmp(product[i].productCode,product[j].productCode)>0)
                                                                {
                                                                                strcpy(tempCode,product[i].productCode);
                                                                                strcpy(product[i].productCode,product[j].productCode);
                                                                                strcpy(product[j].productCode,tempCode);

                                                                                tempItem=product[i].items;
                                                                                product[i].items=product[j].items;
                                                                                product[j].items=tempItem;
                                                                }
                                                }
                                                printf("%s\n",product[i].productCode);
                                                printf("%25d\n",product[i].items);
                                }
                                getch();
    }
    else
    {
       system("cls");
       printf("There is no product!!!");
       getch();
    }
    getch();
}

void addItems(inventory product[])
{
                char tempCode[15];
                int tagAdd;

                system("cls");
                printf("Enter Product Code that you want to add items: ");
                gets(tempCode);
                tagAdd=(search(product,tempCode));

                if(tagAdd>=0)
                {
                                system("cls");
                                product[tagAdd].items++;
                                printf("Product: %s\n",product[tagAdd].productCode);
                                printf("Items:   %d\n\n",product[tagAdd].items);

                                printf("Product Updated!!!");
                                getch();
                }
                else
                {
                                printf("Product Code Do Not Exist!!!");
                                getch();
                }
}

void deleteItems(inventory product[])
{
                char tempCode[15];
                int tagDel;

                system("cls");
                printf("Enter Product Code that you want to add items: ");
                gets(tempCode);
                tagDel=(search(product,tempCode));

                if(tagDel>=0)
                {
                                if(product[tagDel].items>0)
                                {
                                                system("cls");
                                                product[tagDel].items--;
                                                printf("Product: %s\n",product[tagDel].productCode);
                                                printf("Items:   %d\n\n",product[tagDel].items);

                                                printf("Product Updated!!!");
                                                getch();
                                }
                                else
                                {
                                                printf("This Product has no item yet!!!");
                                                getch();
                                }
                }
                else
                {
                                printf("Product Code Do Not Exist!!!");
                                getch();
                }
}

void accessProduct(inventory product[])
{
                char choice;
                system("cls");

                printf("<<Access Products>>\n\n");
                printf("[1]Display Products\n");
                printf("[2]Add Items\n");
                printf("[3]Delete Items\n");
                printf("Choice: ");
                choice=getche();
                switch(choice)
                {
                                case '1': displayProducts(product);break;
                                case '2': addItems(product);break;
                                case '3': deleteItems(product);break;
                                default: printf("\n\nInvalid Selection!!!");getch();break;
                }
}

main()
{
                char choice;
                char user[20];
                inventory product[100];

                system("cls");
                printf("Enter your name: ");
                gets(user);
                do
                {
                                system("cls");
                                printf("<<Basic Inventory System>>\n\n");
                                printf("[1]Add Product\n");
                                printf("[2]Edit Product\n");
                                printf("[3]Delete Product\n");
                                printf("[4]Access Products\n");
                                printf("[5]Exit\n");
                                printf("Choice: ");
                                choice=getche();
                                switch(choice)
                                {
                                                case '1': add(product);break;
                                                case '2': edit(product);break;
                                                case '3': deleteProduct(product);break;
                                                case '4': accessProduct(product);break;
                                                case '5': system("cls");printf("Thank you so much %s, for using my system!!!",user);getch();break;
                                                default: printf("\n\nInvalid Selection!!!");getch();break;
                                }
                }while(choice!='5');
}

Break-ing and Continue-ing


The break and continue keywords disrupts program flow inside loops, whether the for-loop or while-loop.
while(condition) {
    statement 1;
    statement 2;
    break;
    statement 3;
    statement 4;
}

statement 5;
statement n;
The break statement causes the program flow inside a block to forcibly exit (whether for-loop or while-loop). In example code above, as soon as the break statement is encountered, the program control will ignore statement 3 and 4. The while loop will go out of scope and program control will be transferred to the first executable statement immediately after the while block -- in this case, statement 5.
You normally will not use the break statement in this fashion because it doesn't make sense. This statement is usually deployed with more logic finesse. Let me show you an example.
while(condition) {
    statement 1;
    statement 2;
    
    if(someCondition) {
        break;
    }   

    statement 3;
    statement 4;
}

statement 5;
statement n;
This is a more likely use of the break statement. I should warn you though that this is a frowned upon practice. A truly structured programming should have only one entry point and one exit point. Because of the introduction the break statement, our control structure now has one entry point and two exit points.
While this code is innocent enough right now, it could get very hairy and complicated. You will appreciate following the 1-entry-1-exit rule when you have had your fair share of debugging someone else's code and you are wading through a maze of nested structures with lots of breaks peppered into the source code.
Next is the continue keyword. Here is how it behaves.
while(condition) {
    statement 1;
    statement 2;
    continue;
    statement 3;
    statement 4;
}

statement 5;
statement n;
When the continue statement is encountered, statements 3 and 4 will be ignored (just like how it was with the break). Unlike the case in break though, the loop will not go out of scope and will not be immediately terminated.
What the continue statement will do is to go back to the beginning of the loop and forcibly re-evaluate condition. If the condition is still true, then the loop continues normally.