Engineering Admission,Counselling,Colleges,Universities

Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Wednesday, November 6, 2013

How To Study Effectively??

  • 1

    Dream big.

  •  Grab a paper and pen. Jot down all your goals: short-term and long-term. What you want to achieve this year or want you want to do in your life. Remember: Dream big - really big. Stick it up on the wall or on your cork board, in your workplace. That way, when you feel discouraged,your goals will motivate you to achieve them.

Read More...

Friday, October 4, 2013

6 bold statements that can damage your relationship with your professor

I’m sorry for your loss, but this is very inconvenient for me.”
In 14 years as communication faculty and a writer on student-professor dynamics, I thought I heard it all. Then a family member unexpectedly died. Attending the funeral required a class reschedule. My crisis became my student’s logistical annoyance.
In “Six things you should say to your professor”, I suggested ways for students to improve everyday comments that profs find frustrating (“Did I miss anything important?”).
In the past year, I’ve heard students say some bold things that can damage a working relationship. Here are six examples:
1. If your professor makes a change due to unexpected circumstances
Don’t say: “This is very inconvenient for me.”
Do say: “I’m sure this was a difficult decision. Thanks for making it work out.” Or if you disagree, say, “Is there another option? I’m concerned about ________.”
Here’s why: Issues ranging from personal emergency to pace of student learning could change your prof’s well-intended plan. Your schedule likely says “tentative” for that reason. The switch should never negatively impact you. Worried that it will? Open the conversation with care. Your prof probably struggled to retool, too.
2. If you are working while in school
Don’t say: “I’m full-time at my job and have been very busy.”
Do say: “I started my assignment early because my schedule is tight. Could you make sure I’m on the right track?”
Here’s why: Your prof may empathize, but cannot give you leniency because of work. Classes must rank, so schedule your assignment deadlines early. You’ll feel less stressed and likely get more help by eliminating the excuse.

3. If your professor suggests a different direction for your idea
Don’t say: “It’s not worth it to me. I’ll just do something else.”
Do say: “I appreciate the feedback. I see how this approach makes my original idea stronger.” Or “Let me give you some background on why I thought this would work. Is there any way I can move ahead?”
Here’s why: Your prof’s early critique stands to make your final product (and grade!) better. In the workplace, fresh ideas are applauded … and often altered. Will you abandon ship if you can’t get your way? Take a step back, take a breath, and take another look. Accepting feedback with grace is an art and skill, one that definitely should be honed in college.
4. If your professor gives you constructive criticism
Don’t say: “I think you have me confused with another student.”
Do say: “Thank you for pointing out areas where I can improve. Can you clarify what you mean by ___________? I want to make sure I understand what you’re looking for.”
Here’s why: Unless your prof’s comments are clearly about someone else’s work, she knows exactly who you are. And guess what? She cares and wants you to do better. Try not to take the feedback personally, but do follow up if you are confused.
5. If your prof recommends that you drop the class
Don’t say: “I’m on scholarship, so I won’t leave.”
Do say: “Can you explain why you are making this recommendation?” Or, “Is there anything you can suggest so this outcome doesn’t happen again?” (Note: Only ask if you really don’t know. Otherwise, thank your prof for looking out for you!).
Here’s why: Many profs only suggest withdrawal if the situation is unrecoverable. We know the ramifications academically, financially, and emotionally. However, if a student’s situation is truly terminal, refusal to leave won’t move us to rescue.
6. If you are confused
Don’t say: “I wasn’t planning on doing that assignment.”
Do say (as soon as possible!): “I am having trouble with ____________ (be specific!). Can you point me in the right direction?”
Here’s why: Aside from the funeral comment, this one surprises (and saddens!) me the most. Too many students skip an assignment, rather than ask for help. Any points are better than a zero. Your prof can’t help you if you don’t speak up. Get on track and at least complete the work.
While my examples are real, I believe the students did not realize how their words came across.
If you are frustrated or confused, plan your next words with your end goal in mind. Boldness and rudeness could actually escalate your problem, rather than solve it.
Appropriate and respectful communication will get your needs met way faster … and you’ll preserve an important relationship.
Read More...

10 Questions You Shouldn’t Ask Your Professor before the Final

They say that dead men tell no tales. But dying men ask a lot of desperate questions. If you’re just now confronting the reality of final exams, there’s no quick fix advice to ensure a passing grade. The best you can do is study hard, sleep regularly, lay off the Four Loko, and avoid any of the following last minute inquiries:

1. “Complete sentences”? What for?

2. Instead of taking a test, can I summarize this class in a tweet?

3. Do you stamp your Blue Books, to prevent the possibility of pre-composed essays being smuggled into the test? Is it like a run-of-the-mill, A.C. Moore stamp, or something that you special order?

4. Are we doing teacher evaluations before or after this final?

5. May I be excused if there’s a natural disaster or a major political coup on the day of the test? What about globally?

6. Man, that is some beard — when did you start growing that thing!?

7. Why are finals always designed to measure how many random facts we can memorize? Don’t you care about our personal growth?

8. Ok, so ballpark figure… What would be the average of my current grade and zero?

9. Do you realize that my parents pay your salary?

10. Is this textbook still available at the bookstore?
Read More...

5 questions that will take the fear out of talking to your professor

To some students, entering a professor’s office means contracting a life-threatening virus.
To others, it feels like home.
The professor-to-student relationship usually — and unfortunately — lies at one of these two polar extremes. It’s not like colleges provide Professor Relationship 101, either.
Think of the next five hypothetical questions asked by students as a crash course. Hopefully it will debunk myths and stigmas around professors and how they interact with students.
1. “What do I call them? A professor? A doctor? Mister or missus?”
Since kindergarten, students called teachers mister or missus so-and-so. Most students probably didn’t even know a teacher’s first name until college. This can be overwhelming. A legitimate fear for some definitely exists regarding what to call professors. But students just need to trust their instincts.
If a professor said, “… But you can call me by my first name,” then it’s not unprofessional. But if you’re talking to the school president about a professor, you may want to mention him as Professor Smith rather than Joe.
The same goes for emails, interview requests, office-hour signups … and professor, doctor, mister, missus. Use common sense — but don’t believe he or she would never talk to you again if you choose the wrong title.
2. “I don’t want to seem dumb going to a professor’s office. What do I do?”
Some students believe that asking a professor a question — let alone visiting his or her office — means that they will be marked as “the dumb one.”
But the truth is professors would much rather deal with questions before (for example, a midterm) rather being asked afterward, “I bombed this test, can you please raise my grade?”
Professors want to educate students.
Even if you had a dumb question, they’ll respect you for having the guts to ask it. If going to the office still intimidates you, then send an email. A professor or a teaching assistant will either answer the question or set up a meeting at his or her office to discuss it.
3. “But what do I even talk about? Just academics? I’m sure they don’t care about my life.”
Most professors understand the academic and social pressures of being a student. After all, they went through that themselves and have seen all variations of it teaching at your college.
The myth that professors somehow don’t have the pulse of younger students is false. To some degree, they may know more about students than anyone.
For example, it’s often harder to talk to parents or friends about school troubles. But professors can be neutral about it and even share a story or two about a student who went through the same thing.
Not all professors will welcome non-academic talks, but some will. Either way, it doesn’t hurt to ask by saying something like, “I’ve been struggling with (something). Do you have any suggestions?”
4. “I still don’t see a benefit to talk to a professor.”
Just like college admission essays, a great letter of recommendation will stand out. And for someone to write an inspired and truthful recommendation, he or she would need to get to know you.
But don’t think of a professor as a vessel that writes a fancy document. Professors have priceless connections and advice, too.
For example, a professor may know someone looking for a roommate or a job opening with other alumni. Most assume professors only know old alumni. Like the Class of ’45 alumni. But professors still communicate with students who just graduated.
However, do not just send an email asking for a recommendation letter or job offer. You wouldn’t ask a girl to prom on Facebook Chat, right? Do it in person and thank them for their time.
5. “So what you’re saying is that there’s no reason why you shouldn’t talk to a professor?”
Truthfully? Yes.
It is the professor’s job to be available for questions regarding his or her courses. Every professor is different, but most can — and willingly — double as a counselor, friend or mentor.
However, be mindful that professors have lives outside of school, too. (I know, shocking.) Plus, they have to be there for other students as well. Like you would treat your parents or friends, be respectful of their time. Thank them when applicable, and don’t be frustrated if they don’t get back to you immediately.
But most importantly, understand most professors want to help — academically, personally and intellectually.
Who knows? You may even make a lifelong friend out of it.

Read More...

5 things you should never say to your professor


From a professor’s point of view, I want to tell students that effective professors care about their classes, put a lot of time into grading and lesson planning and genuinely want students to take away some knowledge from the course. Being a professor with the technology accessible to students today also means that we are expected to answer emails immediately.

Believe it or not, professors also want to see their students do well in their courses. However, we do form impressions about students and it’s undeniable that we consider assignment extensions based on a student’s attitude and effort. Therefore, in order to build a relationship with your professor, whether it be to earn a good grade for the semester or to secure a letter of recommendation in the future, here are some things to avoid saying at all costs. Seriously.
1. “Did I miss anything important/Did we do anything important in class?”
Let me answer this one for you in one word: Yes. The answer will always be “yes.” The reason is because professors never stand up in front of a room or create an activity that they consider useless. Professors value their course and think the content is important every day. I will also add a bonus pointer here that it should be the student’s responsibility to find out what was missed in class.
2. “I just took your class for an easy A.”
Professors translate this statement as the student didn’t care about the course material or want to put any effort into doing the work. Professors care about their course curriculum and they hope that it will be respected and taken seriously. When professors grade, quality counts, and taking quizzes, writing papers and completing group presentations are all part of earning a passing grade.
3. “I didn’t know we had anything due in this course.”
Saying this to a professor is equivalent to asking, “What days does this class meet?” and, “Do we have a book in this course?” At the college level, students have assignments due in every class, every semester. It is a student’s responsibility to look at the course syllabus. At the collegiate level, a student should not be relying on class announcements or personalized emails to be alerted to upcoming due dates either.
4. “I was busy studying for my other classes so I didn’t do my work for this class.”
Unfortunately, that is not an excuse. Students need to learn time-management skills and effective study habits. It is an insult for a professor to hear that their class wasn’t as important as another one.
5. “Did you answer my email yet?”
There are two reasons why students should never say this to their professors. First, if you expected that the professor should reply to your email, you should spend time checking your inbox for the response before asking. It’s extremely frustrating if a lot of time was put into an email response and the student doesn’t even read the reply. Second, it gives off the impression that you believe the professor’s life revolves around your email. Professors attend meetings, have research demands, serve on committees and sleep at night. Please allow your professor a normal response time, especially if the email was sent at 1 a.m.
Note: The more polite way to handle the situation would be to follow up with a second email if the professor does not answer the first one within a week.
Read More...

Wednesday, September 25, 2013

Must Read :If you want to be the best Programmer

By September 25, 2013 ,

Getting Started

So you want to learn how to program and be a hacker. You’re going to want to start with very simple and easy to learn programming language. You’re choice between: Python or Ruby. They’re similar in syntax and in usage. Pick one, learn it, then learn the other. Or do both at the same time. Read both these books and don’t worry, they’re made for beginners.














Staying Focused

Staying focused and motivated can be a real challenge when it comes to learning something new. Sometimes we do something and we’re just hooked on it. There are programmers out there who are just so fascinated by programming they can do it for hours. However not all of us are like that, and we just say “Damn it, this is boring, I’m going to play video games”. But if you really want to do this, you have to work at it. Everything worth doing is going to be difficult. Here are some ways to stay focused when reading your programming books:

  • Blog about what you have learned. You will understand a topic more if you try to explain it to someone else. 

  • Find your working spot. You will need an area where you can sit and work without being distracted. 

  • Schedule your time. Tell yourself “I will read my programming book for at least 30 minutes at 4:00 pm.” But if you’re having fun don’t stop there! 

  • Reward yourself. “Just 2 more exercises and I can play Starcraft!”

Read More...

Friday, September 20, 2013

Top 10 Tips for Computer Science Students

By September 20, 2013 ,

1.) Math is More Important Than You Think

Math is all over Computer Science in many different ways. Software Engineers will use discrete math when working out algorithm complexity and efficiency, in graph theory, and recursion. People who work more directly with hardware will use discrete math in designing logical circuits and use automata theory for making finite state machines. At that level you are also working with the large amount of math inherent with electrical engineering. In research aspects you will be using probability and statistics for performance measurements and comparisons. Even game programmers use a lot of math when creating 3D environments.

2.) You'll Need To Write More Than Just Code

At the base level you will be writing comments in your code. Those are there for others to comprehend what you are trying to do, so explain what you are doing well. In software engineering you may be writing requirements, specifications, test plans, and more. There may be a time later in your CS career where you may need to write a research paper, that may get peer reviewed. Good writing skills will help you. Pay attention in your business writing classes and learn good technical writing skills now.

3) Don't Procrastinate

We know you've heard it a million times, but this is the worst possible thing you can do in a programming class. When you get an assignment, look it over and start on it right away. In the likely chance that you can't work through an error or figure out the logic, you'll have time to contact your instructor or use other available resources to solve the problem.

4) Don't Over complicate Things

The smaller a block of code is, without being redundant of other code, the better. When you break down algorithms which have nothing in common, often there is a loop or operation which is not unique, other than the parameters involved. A single method/function should not be longer, or wider than a standard 800x600 monitor view. If you comment well, a little larger is acceptable.

6) Impress Your Instructors, But Not Too Much

Your instructor can be your best friend, but don't be a suck up. Ask questions and show your instructor you're interested but don't annoy the rest of the class with constant questions and meaningless comments. If you can get to know your instructor, you may be able to leverage that relationship in the future for internships and recommendations.

7) Flow charting Early and Often

Any good programmer will tell you planning is the most important part of any project. You'll have to flowchart when you get a real job, so get good at it now. Planning a project out before you start, even if it's just good pseudocode, can save you hours of frustration. Don't start your project in the compiler, instead sit down with a piece of paper and plan out your program.

8) Make Sure This is What You Want to Do

Many computer science students get into CS because they like games. Now there are a lot of positions in Computer Game Design that do not require you to be a programmer, so if you are not interested in the coding aspect talk to someone who might direct you to a better path. Areas such as Technical writing, Dramatic Writing, graphic arts, business management, and many more might be better places to go. Use your minor/electives to take computer oriented classes and get to know the CS majors.

9) Use All Your Resources

Don't hit a road block and then panic. There are thousands of resources online to help you work through a problem. From tutorials, to forums , to live help, you should be able to find the help you need. Just remember it can take more than a few minutes for someone to help solve your problem so don't wait till the last minute. Google is definitley your friend and don't feel embarassed if you have to search for your problem. Don't expect people to do the work for you though, you'll still have to put forth some effort.

10) Become a Well Rounded Programmer

Programming is more than just C++ or Java. If you plan on programming for a living, you'll need to learn the business side of programming. This includes things like systems analysis, databases, security, and documentation. Also realize that C++ isn't the only language out there, you should be able to jump fairly quickly from language to language. Don't get stuck in one language. Learn the basics of other languages including web based. In addition to code, focus on your humanities. Nobody wants to interact with a dull uncultured nerd. Take classes that interest you and will provide you with a good non-technical education as well.
Read More...

Tuesday, September 10, 2013

Departmental Store-Best College Mini Projects C

By September 10, 2013 ,
This mini project is about department store all features required for department store are added in this programe.You can copy the source code and compile it in a code block.This project is perfect for your college mini project in C.



Program:-

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<windows.h>

#define ANS 15
#define ACS 4
 COORD coord={0,0}; // this is global variable
                                    //center of axis is set to the top left cornor of the screen
void gotoxy(int x,int y)
{
    coord.X=x;
    coord.Y=y;
    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
/*declaration of checking functions*/
void c_code(char[]);
int check(char[]);

/*structure declaration*/
typedef struct{
char name[ANS],code[ACS];
float rate;
int quantity;
}rec;
rec item;

/*declaration of display functions*/
void curser(int);
void dbill();
void d_mainmenu();
void display(rec *,int,int);
void window(int,int,int,int);
void dis_con();
void d_search();
void highlight(int,int);

/*declaration of main menu functions*/
void bill() ;
void edit();
void add();
void del();
void exit();

/*declaration of display submenu functions*/
void d_code();
void d_rate();
void d_quan();
void d_all();

/*start of main*/
int main()
{
d_mainmenu();
return 0;
}



void d_mainmenu()
{
int i;
char ch;
const char *menu[]={"   Calculate Bill","   Add Goods","   Edit Goods","   Display All ","   Search", "   Delete Goods","   Exit"};
system("cls");
//textbackground(11);
//textcolor(0);
//_setcursortype(_NOCURSOR);
window(25,50,20,32);
gotoxy(33,18);printf("MAIN MENU");
for (i=0;i<=6;i++){
gotoxy(30,22+i+1);printf("%s\n\n\n",menu[i]);}
curser(7);
}

void d_search()
{
char ch;
int i;
    const char *menu[]={"   By Code","   By Rate","   By Quantity","   Back to main menu"};
system("cls");
//textbackground(11);
//textcolor(0);
window(25,50,20,32);
gotoxy(33,18);printf("SEARCH MENU");
for (i=0;i<=3;i++){
gotoxy(30,22+i+1);printf("%s\n\n\n",menu[i]);}
curser(4);
}

/*function for cursor movement*/
void curser(int no)
{
    int count=1;
    char ch='0';
    gotoxy(30,23);
while(1){
switch(ch){
case 80:
count++;
if (count==no+1) count=1;
break;
case 72:
count--;
if(count==0) count=no;
break;
}
highlight(no,count);
ch=getch();
if(ch=='\r'){
if(no==7){
if (count==1) bill() ;
else if(count==2) add();
else if(count==3) edit();
else if (count==4) d_all();
else if (count==5) d_search();
else if (count==6) del();
else   exit(0);
}
if(no==4){
if (count==1) d_code();
else if (count==2)d_rate();
else if (count==3) d_quan();
else d_mainmenu();
}
}
}
}

void highlight(int no,int count)
{
if (no==4){
//textbackground(11);
//textcolor(0);
gotoxy(30,23);printf("   By Code          ");
gotoxy(30,24);printf("   By Rate          ");
gotoxy(30,25);printf("   By Quantity      ");
gotoxy(30,26);printf("   Back to main menu");
//textcolor(0);
//textbackground(2);
switch (count)
{
case 1:
gotoxy(30,23);
printf(" - By Code          ");
break;
case 2:
gotoxy(30,24);
printf(" - By Rate          ");
break;
case 3:
gotoxy(30,25);
printf(" - By Quantity      ");
break;
case 4:
gotoxy(30,26);
printf(" - Back to main menu");
break;
}
}

if(no==7){
//textbackground(11);
//textcolor(0);
gotoxy (30,23);printf("   Calculate Bill ");
gotoxy (30,24);printf("   Add Goods      ");
gotoxy (30,25);printf("   Edit Goods     ");
gotoxy (30,26);printf("   Display All    ");
gotoxy (30,27);printf("   Search         ");
gotoxy (30,28);printf("   Delete Goods   ");
gotoxy (30,29);printf("   Exit           ");
//textcolor(0);
//textbackground(2);
switch(count){
case 1:
gotoxy (30,23);
printf(" - Calculate Bill ");
break;
case 2:
gotoxy (30,24);
printf(" - Add Goods      ");
break;
case 3:
gotoxy (30,25);
printf(" - Edit Goods     ");
break;
case 4:
gotoxy (30,26);
printf(" - Display All    ");
break;
case 5:
gotoxy (30,27);
printf(" - Search         ");
break;
case 6:
gotoxy (30,28);
printf(" - Delete Goods   ");
break;
case 7:
gotoxy (30,29);
printf(" - Exit           ");
break;
}
}
}

void bill()
{
char x[4]={0};
int j=29,q=0,size=0,i=1;
float total=0,gtotal=0;
FILE *file;
file=fopen("record.txt","r+b");
rewind(file);
system("cls");
dbill();
gotoxy(26,15);printf("enter  \"end\" to finish input");
while(1){
gotoxy(25,18);printf("                    ");
gotoxy(25,19);printf("                    ");
gotoxy(25,18);printf("enter item code:");
scanf("%s",x);
if(strcmp(x,"end")==0)
break;
gotoxy(25,19);printf("enter quantity:");
scanf("%d",&q);
rewind(file);
while(fread(&item,sizeof(item),1,file)){
if((strcmp(item.code,x)==0)){
total=item.rate*q;
gotoxy(11,j);printf("%4d",i);
printf("%9s",item.name);
printf("%13d",q);
printf("%15.2f",item.rate);
printf("%13.2f",total);
gtotal=gtotal+total;
size=sizeof(item);
item.quantity=item.quantity-q;
j+=2; i++;
fseek(file,-size,SEEK_CUR);fwrite(&item,sizeof(item),1,file);
break;
}
 }
}
if(gtotal!=0){
gotoxy(30,j+5);
printf("TOTAL AMOUNT = NRs. %6.2f",gtotal);
}
fclose(file);
getch();
d_mainmenu();
}
 /*function to display bill window*/
void dbill()
{
int i;
gotoxy(20,10);
//;
for (i=1;i<=10;i++)
printf("*");
printf(" * FASHION WEAR * ");
for (i=1;i<=10;i++)
      printf("*");
printf("\n\n");
gotoxy(30,11);printf("Departmental Store");
//textcolor(1);
gotoxy(32,25);printf("CUSTOMER'S BILL") ;
//textcolor(8);
gotoxy(13,27);printf("SN.   Item Name     Quantity     Rate          Total");

}
/*function to add records*/
void add ()
{
FILE *file;
char y[ACS],x[12];
system("cls");
//textbackground(11);
//textcolor(0);
gotoxy(25,25);printf("Enter new record(Y/N)?");
while(toupper(getche())=='Y'){
system("cls");
file=fopen("record.txt","ab");
c_code(y);
strcpy(item.code,y);
gotoxy(22,28);printf("Enter rate of the item:");
scanf("%f",&item.rate);
gotoxy(22,30);printf("Enter quantity of the item:");
scanf("%d",&item.quantity);
gotoxy(22,32);printf("Enter name of the item:");
scanf("%s",item.name);
fseek(file,0,SEEK_END);fwrite(&item,sizeof(item),1,file);
fclose(file);
gotoxy(22,34);printf("Enter new record(Y/N)?");

   }
   d_mainmenu();
}

 /*function to check availability of code*/
void c_code(char y[])
{
int flag;
FILE *file;
file=fopen("record.txt","rb");
while(1){
system("cls");
window(20,58,23,36);
gotoxy(32,18);printf(" ADD ARTICLES ")  ;
flag=1;
rewind(file);
gotoxy(22,25);printf("Enter new code of the article:");
scanf(" %[^\n]",y);
while(fread(&item,sizeof(item),1,file)==1){
if (strcmp(y,item.code)==0){
flag=0;
gotoxy(26,30);printf("code already exists");
gotoxy(29,32);printf("enter again");getch();
break;
}
}
if (flag==1)
break;
}
}

/*function for editing*/
void edit()
{
int flag=0,choice;
char x[ACS],y[ACS];
FILE *file;
int size;
system("cls");
//textcolor(0);
//textbackground(11);
window(20,63,20,46);
gotoxy(35,18);printf("EDIT RECORDS");
;
gotoxy(25,23);printf("enter item code: ");
scanf("%s",x);
flag=check(x);
if(flag==0){
file=fopen("record.txt","r+b");
rewind(file);
while (fread(&item,sizeof (item),1,file)){
if(strcmp(item.code,x)==0){
//textcolor(0);
gotoxy(25,27);printf("name       = %s",item.name);
gotoxy(25,28);printf("code       = %s",item.code);
gotoxy(25,29);printf("rate       = %g",item.rate);
gotoxy(25,30);printf("quantity   = %d",item.quantity);
gotoxy(25,32);; printf("do you want to edit this record(y/n):");
fflush(file);
if(toupper(getche())=='Y'){
//textcolor(0);
gotoxy(25,34); printf("1- edit name ");
gotoxy(25,35); printf("2- edit code ");
gotoxy(25,36); printf("3- edit rate ");
gotoxy(25,37); printf("4- edit quantity ");
gotoxy(25,39);  ; printf(" enter your choice(1, 2, 3, 4) ");
scanf("%d",&choice);
switch(choice){
case 1:
system("cls");
window(23,48,20,40);
gotoxy(35,18);printf("EDIT RECORDS");
gotoxy(25,24); printf(" enter new name: ");
scanf("%s",item.name);
size=sizeof(item);
fseek(file,-size,SEEK_CUR);fwrite(&item,sizeof(item),1,file);
break;
case 2:
system("cls");
window(23,65,20,40);
gotoxy(35,18);printf("EDIT RECORDS");
gotoxy(25,24);
c_code(y);
strcpy(item.code,y);
size=sizeof(item);
fseek(file,-size,SEEK_CUR);fwrite(&item,sizeof(item),1,file);
break;
case 3:
system("cls");
window(23,65,20,40);
gotoxy(35,18);printf("EDIT RECORDS");
gotoxy(25,24);
printf(" enter new rate: ");
scanf("%f",&item.rate);
size=sizeof(item);
fseek(file,-size,SEEK_CUR);fwrite(&item,sizeof(item),1,file);
break;
case 4:
system("cls");
window(23,65,20,40);
gotoxy(35,18);printf("EDIT RECORDS");
gotoxy(25,24);
printf(" enter new quantity: ");
scanf("%d",&item.quantity);
size=sizeof(item);
fseek(file,-size,1);fwrite(&item,sizeof(item),1,file);
break;
}
gotoxy(27,30);printf("--- item edited---");
break;
}
}
}
}
if (flag==1){
gotoxy(32,30);printf("item does not exist");
gotoxy(36,32);printf("TRY ABGAIN");
}
getch();
fclose(file);
d_mainmenu();
}

/*function to display all records*/
void d_all()
{
int i,j=1;
FILE *file;
dis_con();
file=fopen("record.txt","rb");
rewind(file);
i=26;
fflush(file);
while(fread(&item,sizeof(item),1,file)){
display(&item,i,j);
i++;
j++;
if ((j%20)==0){
      gotoxy(27,47);/*textcolor(0)*/;printf("press any key to see more...........");
      getch();
      system("cls");
      dis_con();
      i=26;
      continue;
}
}
getch();
if (i==26) {
gotoxy(24,30); printf("-- no articles found --");
}
getch();
fclose(file);
d_mainmenu();
}

/*function to display by quantity*/
void d_quan()
{
int i,j=1;
int a,b;
FILE *file;
dis_con();
file=fopen("record.txt","rb");
rewind(file);
i=26;
gotoxy(16,20);;printf("enter lower range: ");
scanf("%d",&a);
gotoxy(16,21);printf("enter upper range:");
scanf("%d",&b);
fflush(file);
while(fread(&item,sizeof(item),1,file)){
if((item.quantity>=a)&&(item.quantity<=b)){
display(&item,i,j);
i++;
j++;
if ((j%20)==0){
gotoxy(27,47);printf("press any key to see more...........");
getch();
system("cls");
dis_con();
i=26;
continue;
}
  }
}
getch();
if (i==26){
gotoxy(28,30); printf(" no item found ");
}
getch();
d_search();
fclose(file);
}

/*function to display by rate*/
void d_rate(){
int i,j=1;
float a,b;
FILE *file;
dis_con();
file=fopen("record.txt","rb");
rewind(file);
i=26;
gotoxy(16,20);;printf("enter lower range: ");
scanf("%f",&a);
gotoxy(16,21);printf("enter upper range: ");
scanf("%f",&b);
fflush(file);
while(fread(&item,sizeof(item),1,file)){
if((item.rate>=a)&&(item.rate<=b)){
display(&item,i,j);
i++;
j++;
if ((j%20)==0){
gotoxy(27,47);printf("press any key to see more...........");
getch();
system("cls");
dis_con();
i=26;
continue;
}
}
}
getch();
if (i==26){
gotoxy(28,30); printf(" no item found ");
}
getch();
fclose(file);
d_search();
}

/*function to display by code*/
void d_code()
{
int i,j=1;
char x[4]={0};
FILE *file;
dis_con();
file=fopen("record.txt","rb");
rewind(file);
i=26;
gotoxy(16,20);;printf("enter item code: ");
scanf("%s",x);
fflush(file);
while(fread(&item,sizeof(item),1,file)){
if((strcmp(item.code,x)==0)){
display(&item,i,j);
i++;
j++;
break;
}
}
if (i==26){
gotoxy(28,30); printf("no item found");
}
getch();
fclose(file);
d_search();
}

/*function to display window for item display*/
void dis_con()
{
int i;
system("cls");
gotoxy(20,10);
;
for (i=1;i<=10;i++)
printf("*");
printf(" * FASHION WEAR * ");
for (i=1;i<=10;i++)
      printf("*");
printf("\n\n");
gotoxy(30,11);printf("Departmental Store");
//textcolor(1);
gotoxy(32,17);printf("RECORDS") ;
//textcolor(8);
gotoxy(18,23);printf ("SN   Item Name   Item Code      Rate     Quantity");
}

/*function to display in screen*/
void display(rec *item,int i,int j)
{
gotoxy(16,i);//textcolor(13);
printf("%4d",j);
printf("%9s",item->name);
printf("%12s",item->code);
printf("%14.2f",item->rate);
printf("%11d",item->quantity);
}

/*function to delete records*/
void del()
{
int flag;
char x[ANS];
FILE *file,*file1;
system("cls");
//textbackground(11);
//textcolor(0);
window(23,51,25,34);
gotoxy(29,18);printf("DELETE ARTICLES");
gotoxy(27,27);printf("enter item code: ");
scanf("%s",x);
flag=check(x);
if(flag==0){
file1=fopen("record1.txt","ab");
file=fopen("record.txt","rb");
rewind(file);
while (fread(&item,sizeof (item),1,file)){
if(strcmp(item.code,x)!=0)
fwrite(&item,sizeof(item),1,file1);
}
gotoxy(27,29);printf("---item deleted---");
remove("record.txt");
rename("record1.txt","record.txt");
}
if (flag==1){
gotoxy(25,29);printf("---item does not exist---");
gotoxy(30,31);printf("TRY AGAIN");
}
fclose(file1);
fclose(file);
getch();
d_mainmenu();
}

/*function to check validity of code while editing and deleting*/
int check(char x[ANS])
{
FILE *file;
int flag=1;
file=fopen("record.txt","rb");
rewind(file);
while (fread(&item,sizeof (item),1,file)){
if(strcmp(item.code,x)==0){
flag=0;
break;
}
}
fclose(file);
return flag;
 }

/*function to display box*/
void window(int a,int b,int c,int d)
{
int i;
system("cls");
gotoxy(20,10);
//textcolor(1);
for (i=1;i<=10;i++)
printf("*");
printf(" * FASHION WEAR * ");
for (i=1;i<=10;i++)
      printf("*");
printf("\n\n");
gotoxy(30,11);printf("Departmental Store");
//textcolor(4);
for (i=a;i<=b;i++){
      gotoxy(i,17);printf("\xcd");
      gotoxy(i,19);printf("\xcd");
      gotoxy(i,c);printf("\xcd");
      gotoxy(i,d);printf("\xcd");
      }

gotoxy(a,17);printf("\xc9");
gotoxy(a,18);printf("\xba");
gotoxy(a,19);printf("\xc8");
gotoxy(b,17);printf("\xbb");
gotoxy(b,18);printf("\xba");
gotoxy(b,19);printf("\xbc");
//textcolor(4);
for(i=c;i<=d;i++){
gotoxy(a,i);printf("\xba");
gotoxy(b,i);printf("\xba");
}
gotoxy(a,c);printf("\xc9");
gotoxy(a,d);printf("\xc8");
gotoxy(b,c);printf("\xbb");
gotoxy(b,d);printf("\xbc");
//textbackground(11);
//textcolor(0);
}
Read More...

Snake Game-Best College Mini Projects C

By September 10, 2013 ,
We will provide you some of the best c programs for your college mini projects.These Program is completely error free.This Project is based on the Snake game which runs in the console.
you can use arrow key to move the snake.


Program:-


#include <stdio.h>

#include <time.h>

#include <stdlib.h>

#include <conio.h>

#include<time.h>

#include<ctype.h>

#include <time.h>

#include <windows.h>

#include <process.h>

#define UP 72

#define DOWN 80

#define LEFT 75

#define RIGHT 77

int length;

int bend_no;

int len;

char key;

void record();

void load();

int life;

void Delay(long double);

void Move();

void gotoxy(int x, int y);

void GotoXY(int x,int y);

void Bend();

void Boarder();

void Down();

void Left();

void Up();

void Right();

void ExitGame();

int Scoreonly();

struct coordinate{

    int x;

    int y;

    int direction;

};

typedef struct coordinate coordinate;

coordinate head, bend[500],food,body[30];

int main()

{

    char key;

    Print();

    system("cls");

    load();

    length=5;

    head.x=25;

    head.y=20;

    head.direction=RIGHT;

    Boarder();

    Food(); //to generate food coordinates initially

    life=3; //number of extra lives

    bend[0]=head;

    Move();   //initialing initial bend coordinate

    return 0;

}



void Move()

{

    int a,i;

    do{

        Food();

        fflush(stdin);

        len=0;

        for(i=0;i<30;i++)

        {

            body[i].x=0;

            body[i].y=0;

            if(i==length)

            break;

        }

        Delay(length);

        Boarder();

        if(head.direction==RIGHT)

            Right();

        else if(head.direction==LEFT)

            Left();

        else if(head.direction==DOWN)

            Down();

        else if(head.direction==UP)

            Up();

        ExitGame();



    }while(!kbhit());

    a=getch();

    if(a==27)

    {

        system("cls");

        exit(0);

    }

    key=getch();

    if((key==RIGHT&&head.direction!=LEFT&&head.direction!=RIGHT)||(key==LEFT&&head.direction!=RIGHT&&head.direction!=LEFT)||(key==UP&&head.direction!=DOWN&&head.direction!=UP)||(key==DOWN&&head.direction!=UP&&head.direction!=DOWN))

    {

        bend_no++;

        bend[bend_no]=head;

        head.direction=key;

        if(key==UP)

            head.y--;

        if(key==DOWN)

            head.y++;

        if(key==RIGHT)

            head.x++;

        if(key==LEFT)

            head.x--;

        Move();



    }

    else if(key==27)

    {

        system("cls");

        exit(0);

    }

    else

    {

        printf("\a");

        Move();

    }

}

void gotoxy(int x, int y)

{

 COORD coord;

 coord.X = x;

 coord.Y = y;

 SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);

}

void GotoXY(int x, int y)

{

    HANDLE a;

    COORD b;

    fflush(stdout);

    b.X = x;

    b.Y = y;

    a = GetStdHandle(STD_OUTPUT_HANDLE);

    SetConsoleCursorPosition(a,b);

 }

void load(){

    int row,col,r,c,q;

    gotoxy(36,14);

    printf("loading...");

    gotoxy(30,15);

    for(r=1;r<=20;r++){

    for(q=0;q<=100000000;q++);//to display the character slowly

    printf("%c",177);}

    getch();

}

void Down()

{

    int i;

    for(i=0;i<=(head.y-bend[bend_no].y)&&len<length;i++)

    {

        GotoXY(head.x,head.y-i);

        {

            if(len==0)

                printf("v");

            else

                printf("*");

        }

        body[len].x=head.x;

        body[len].y=head.y-i;

        len++;

    }

    Bend();

    if(!kbhit())

        head.y++;



}

void Delay(long double k)

{

    Score();

    long double i;

    for(i=0;i<=(10000000);i++);

}

void ExitGame()

{

    int i,check=0;

    for(i=4;i<length;i++)   //starts with 4 because it needs minimum 4 element to touch its own body

    {

        if(body[0].x==body[i].x&&body[0].y==body[i].y)

        {

            check++;    //check's value increases as the coordinates of head is equal to any other body coordinate

        }

        if(i==length||check!=0)

            break;

    }

    if(head.x<=10||head.x>=70||head.y<=10||head.y>=30||check!=0)

    {

        life--;

        if(life>=0)

        {

            head.x=25;

            head.y=20;

            bend_no=0;

            head.direction=RIGHT;

            Move();

        }

        else

        {

            system("cls");

            printf("All lives completed\nBetter Luck Next Time!!!\nPress any key to quit the game\n");

            record();

            exit(0);

        }

    }

}

void Food()

{

    if(head.x==food.x&&head.y==food.y)

    {

        length++;

        time_t a;

        a=time(0);

        srand(a);

        food.x=rand()%70;

        if(food.x<=10)

            food.x+=11;

        food.y=rand()%30;

        if(food.y<=10)

            food.y+=11;

    }

    else if(food.x==0)/*to create food for the first time coz global variable are initialized with 0*/

    {

        food.x=rand()%70;

        if(food.x<=10)

            food.x+=11;

        food.y=rand()%30;

        if(food.y<=10)

            food.y+=11;

    }



}

void Left()

{

    int i;

    for(i=0;i<=(bend[bend_no].x-head.x)&&len<length;i++)

    {

        GotoXY((head.x+i),head.y);

       {

                if(len==0)

                    printf("<");

                else

                    printf("*");

        }

        body[len].x=head.x+i;

        body[len].y=head.y;

        len++;

    }

    Bend();

    if(!kbhit())

        head.x--;



}

void Right()

{

    int i;

    for(i=0;i<=(head.x-bend[bend_no].x)&&len<length;i++)

    {

        //GotoXY((head.x-i),head.y);

        body[len].x=head.x-i;

        body[len].y=head.y;

        GotoXY(body[len].x,body[len].y);

        {

            if(len==0)

                printf(">");

            else

                printf("*");

        }

        /*body[len].x=head.x-i;

        body[len].y=head.y;*/

        len++;

    }

    Bend();

    if(!kbhit())

        head.x++;



}

void Bend()

{

    int i,j,diff;

    for(i=bend_no;i>=0&&len<length;i--)

    {

            if(bend[i].x==bend[i-1].x)

            {

                diff=bend[i].y-bend[i-1].y;

                if(diff<0)

                    for(j=1;j<=(-diff);j++)

                    {



                        body[len].x=bend[i].x;

                        body[len].y=bend[i].y+j;

                        GotoXY(body[len].x,body[len].y);

                        printf("*");

                        len++;

                        if(len==length)

                            break;

                    }

                else if(diff>0)

                    for(j=1;j<=diff;j++)

                    {

                        /*GotoXY(bend[i].x,(bend[i].y-j));

                        printf("*");*/

                        body[len].x=bend[i].x;

                        body[len].y=bend[i].y-j;

                        GotoXY(body[len].x,body[len].y);

                        printf("*");

                        len++;

                        if(len==length)

                            break;

                    }

            }

        else if(bend[i].y==bend[i-1].y)

        {

            diff=bend[i].x-bend[i-1].x;

            if(diff<0)

                for(j=1;j<=(-diff)&&len<length;j++)

                {

                    /*GotoXY((bend[i].x+j),bend[i].y);

                    printf("*");*/

                    body[len].x=bend[i].x+j;

                    body[len].y=bend[i].y;

                    GotoXY(body[len].x,body[len].y);

                        printf("*");

                    len++;

                    if(len==length)

                            break;

                }

            else if(diff>0)

                for(j=1;j<=diff&&len<length;j++)

                {

                    /*GotoXY((bend[i].x-j),bend[i].y);

                    printf("*");*/

                    body[len].x=bend[i].x-j;

                    body[len].y=bend[i].y;

                    GotoXY(body[len].x,body[len].y);

                        printf("*");

                    len++;

                    if(len==length)

                        break;

                }

        }

    }

}

void Boarder()

{

    system("cls");

    int i;

    GotoXY(food.x,food.y);   /*displaying food*/

        printf("F");

    for(i=10;i<71;i++)

    {

        GotoXY(i,10);

            printf("!");

        GotoXY(i,30);

            printf("!");

    }

    for(i=10;i<31;i++)

    {

        GotoXY(10,i);

            printf("!");

        GotoXY(70,i);

        printf("!");

    }

}

void Print()

{

    //GotoXY(10,12);

    printf("\tWelcome to the mini Snake game.(press any key to continue)\n");

   getch();

    system("cls");

    printf("\tGame instructions:\n");

    printf("\n-> Use arrow keys to move the snake.\n\n-> You will be provided foods at the several coordinates of the screen which you have to eat. Everytime you eat a food the length of the snake will be increased by 1 element and thus the score.\n\n-> Here you are provided with three lives. Your life will decrease as you hit the wall or snake's body.\n\n-> YOu can pause the game in its middle by pressing any key. To continue the paused game press any other key once again\n\n-> If you want to exit press esc. \n");

    printf("\n\nPress any key to play game...");

    if(getch()==27)

    exit(0);

}

void record(){

    char plname[20],nplname[20],cha,c;

    int i,j,px;

    FILE *info;

    info=fopen("record.txt","a+");

    getch();

    system("cls");

    printf("Enter your name\n");

    scanf("%[^\n]",plname);

    //************************

    for(j=0;plname[j]!='\0';j++){ //to convert the first letter after space to capital

    nplname[0]=toupper(plname[0]);

    if(plname[j-1]==' '){

    nplname[j]=toupper(plname[j]);

    nplname[j-1]=plname[j-1];}

    else nplname[j]=plname[j];

    }

    nplname[j]='\0';

    //*****************************

    //sdfprintf(info,"\t\t\tPlayers List\n");

    fprintf(info,"Player Name :%s\n",nplname);

     //for date and time
   time_t mytime;

   mytime = time(NULL);

   fprintf(info,"Played Date:%s",ctime(&mytime));

      //**************************

      fprintf(info,"Score:%d\n",px=Scoreonly());//call score to display score

      //fprintf(info,"\nLevel:%d\n",10);//call level to display level

    for(i=0;i<=50;i++)

    fprintf(info,"%c",'_');

    fprintf(info,"\n");

    fclose(info);

    printf("wanna see past records press 'y'\n");

    cha=getch();

    system("cls");

    if(cha=='y'){

    info=fopen("record.txt","r");

    do{

        putchar(c=getc(info));

        }while(c!=EOF);}

      fclose(info);

}

int Score()

{

    int score;

    GotoXY(20,8);

    score=length-5;

    printf("SCORE : %d",(length-5));

    score=length-5;

    GotoXY(50,8);

    printf("Life : %d",life);

    return score;

}

int Scoreonly()

{

int score=Score();

system("cls");

return score;

}

void Up()

{

    int i;

    for(i=0;i<=(bend[bend_no].y-head.y)&&len<length;i++)

    {

        GotoXY(head.x,head.y+i);

        {

            if(len==0)

                printf("^");

            else

                printf("*");

        }

        body[len].x=head.x;

        body[len].y=head.y+i;

        len++;

    }

    Bend();

    if(!kbhit())

        head.y--;



}
Read More...