How to convert .cpp to .exe using code(command prompt)?

Aug 24, 2008 at 12:56am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/***************************************************************
Author: Abdul Hafiz Bin Ibrahim
Date: 24/08/2008
Description: Calculate total of (credits hour * gred point) and
             devided by total of credits hour.
Input: (int)  ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,totalCh=0
       (float)  sc1,sc2,sc3,sc4,sc5,sc6,sc7,sc8,sc9,sc10
Output: (double) totalGPA
****************************************************************/

#include <stdio.h>

void main(void)
{
	int ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,totalCh=0;
	float sc1,sc2,sc3,sc4,sc5,sc6,sc7,sc8,sc9,sc10;
	double totalGPA;

	printf("GPA CALCULATOR\n");
	printf("Max 10 Subjects\n\n");
	printf("Gred A = 4.00\nGred A- = 3.67\nGred B+ = 3.33\nGred B = 3.00\nGred B- = 2.67\nGred C+ = 2.33\nGred C- = 2.00\nGred D+ = 1.67\nGred D = 1.00\nGred E = 0.00\n");
	
	printf("\nEnter paper 1 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc1);
	printf("\nEnter paper 1 credit hour\n");
	scanf("%d",&ch1);
	totalCh = totalCh + ch1;

	printf("\nEnter paper 2 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc2);
	printf("\nEnter paper 2 credit hour\n");
	scanf("%d",&ch2);
	totalCh = totalCh + ch2;

	printf("\nEnter paper 3 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc3);
	printf("\nEnter paper 3 credit hour\n");
	scanf("%d",&ch3);
	totalCh = totalCh + ch3;

	printf("\nEnter paper 4 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc4);
	printf("\nEnter paper 4 credit hour\n");
	scanf("%d",&ch4);
	totalCh = totalCh + ch4;

	printf("\nEnter paper 5 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc5);
	printf("\nEnter paper 5 credit hour\n");
	scanf("%d",&ch5);
	totalCh = totalCh + ch5;

	printf("\nEnter paper 6 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc6);
	printf("\nEnter paper 6 credit hour\n");
	scanf("%d",&ch6);
	totalCh = totalCh + ch6;

	printf("\nEnter paper 7 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc7);
	printf("\nEnter paper 7 credit hour\n");
	scanf("%d",&ch7);
	totalCh = totalCh + ch7;

	printf("\nEnter paper 8 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc8);
	printf("\nEnter paper 8 credit hour\n");
	scanf("%d",&ch8);
	totalCh = totalCh + ch8;

	printf("\nEnter paper 9 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc9);
	printf("\nEnter paper 9 credit hour\n");
	scanf("%d",&ch9);
	totalCh = totalCh + ch9;

	printf("\nEnter paper 10 pointer (0.00-4.00 only)\n");
	scanf("%f",&sc10);
	printf("\nEnter paper 10  credit hour\n");
	scanf("%d",&ch10);
	totalCh = totalCh + ch10;

	totalGPA = ((sc1 * ch1) + (sc2 * ch2) + (sc3 * ch3) + (sc4 * ch4) + (sc5 * ch5) + (sc6 * ch6) + (sc7 * ch7) + (sc8 * ch8) + (sc9 * ch9) + (sc10 * ch10)) / totalCh;
	
	printf("\n\nYour total GPA => %f\n\n",totalGPA);
}


I clicked my source file (.cpp) in 'debug folder' but it doesn't calculate the total GPA....it quickly closed after I enter all the inputs(credits hour & gred points)....help me...(sorry i am not good in english, still not proficient)....
Aug 24, 2008 at 3:56am
You say it quickly closes...perhaps this is your problem?
http://www.cplusplus.com/forum/beginner/1988/
Aug 24, 2008 at 2:01pm
Oh, ok thanks!
Topic archived. No new replies allowed.