Computer problems,Computer help
*AX SOFT>>>Programming & Design

So i made my C++ code in notepad but it doesnt open for more than.1 seconds?


i put the getch(); thing and included lybaries but i only opens for a little

heres the code:

#include <stdio.h>
#include <conio.h>

main()


{
int grade1, grade2, grade3, grade4, grade5, grade6, total, average;

printf("enter grade1: "); /* whitch grade to put in */
scanf("%d", &grade1);
if (grade1 >= 90)
printf("A\n\n", grade1);
else
if(grade1 >= 80)
printf("B\n\n");
else
if (grade1 >=70)
printf("C\n\n");
else
if (grade1 >=60)
printf("D\n\n");
else
printf("F\n\n");

printf("enter grade2: ");
scanf("%d", &grade2);
if (grade2 >= 90)
printf("A\n\n", grade2);
else
if(grade2 >= 80)
printf("B\n\n");
else
if (grade2 >=70)
printf("C\n\n");
else
if (grade2 >=60)
printf("D\n\n");
else
printf("F\n\n");
printf("enter grade3: ");
scanf("%d", &grade3);
if (grade1 >= 90)
printf("A\n\n", grade3);
else
if(grade3 >= 80)
printf("B\n\n");
else
if (grade3 >=70)
printf("C\n\n");
else
if (grade3 >=60)
printf("D\n\n");
else
printf("F\n\n");
printf("enter grade4: ");
scanf("%d", &grade4);
if (grade4 >= 90)
printf("A\n\n", grade1);
else
if(grade4 >= 80)
printf("B\n\n");
else
if (grade4 >=70)
printf("C\n\n");
else
if (grade4 >=60)
printf("D\n\n");
else
printf("F\n\n");
printf("enter grade5: ");
scanf("%d", &grade5);
if (grade5 >= 90)
printf("A\n\n", grade1);
else
if(grade5 >= 80)
printf("B\n\n");
else
if (grade5 >=70)
printf("C\n\n");
else
if (grade5 >=60)
printf("D\n\n");
else
printf("F\n\n");
printf("enter grade6: ");
scanf("%d", &grade6);
if (grade6 >= 90)
printf("A\n\n", grade1);
else
if(grade6 >= 80)
printf("B\n\n");
else
if (grade6 >=70)
printf("C\n\n");
else
if (grade6 >=60)
printf("D\n\n");
else
printf("F\n\n");

total = (grade1 + grade2 + grade3 + grade4 + grade5 + grade6);
/* adds up grades^ */
average = total / 6;

printf("Class average is %d\n", average);



getch();
return 0;
}

either run it from the windows command line (start button -> run -> type 'cmd' and hit enter -> navigate to your program)

or at the end of you program make a temporary variable up... force it to get user input into that temp variable.. this is to do nothing more than to put a check before the program exits.. again temp variable does nothing but give the cin statement something to dump a value to..

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • Help with c programming not c++?

    That sounds right. Can't say for sure, because u didn't post your code. What i can say for sure, is that this is how u pass an array to another function... (for print, computations, etc...

  • In Excel VBA, how could we make a cell border flash?

    I am not sure it is possible, it is certainly not one of the border linestyles (I just iterated through all possible values) One approach might be to store the clipboard contents, then put them ...

  • What is the RSS for?

    RSS stands for Really Simple Syndication. It is basically an XML feed (or file) that sits on a site out on the internet. Any time you get this file from the URL it usually produces an up to date ...

  • Visual Studio 2005: Visual Basic: Cursor position?

    I think your problem here is you are not referencing the cursor from the current form. The form you are working with has a cursor property. Try this: If Not Me .Cursor.Equals(Cursors.D...

  • HELPP! with this c++ program please("Find & Replace"), have my annual lab test tomm!!?

    I think we need some more information about this problem before we can help you. First, how are you reading in the paragraph of text? Is the user going to enter it, or do you read it from a file...

  • I am lost ...in VB.NET?

    I'm not sure about the version of VB.net because i never bought it but used in my school first of all learn VB which is simialar to basic (or Qbasic) language and different from java the...

  • How to run my newly created program in Visual C++?

    to compile or build: select Build and then Build Solution will compile once it has been built you can run your program from the Debug menu by selecting Start Without Debugging -------- EDIT:...

  • ASP ==>grid views?

    Yes, you can. The DataSource property in .Net 2.0 and up can accept anything with an IEnumerable interface, and it will use your public properties to auto-populate columns. E.g. List<MyBusi...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster