First VC++ 9 (2008) Project

I made an app in C++.net 9 (2008) as my first project.
All it does is scan for prime numbers from up to a specific range:
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
// random0.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <windows.h>
#include <iostream>

void prime_num(int num);
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
prime:
	int num;
	int msgbox = MessageBox(NULL, L"Greetings, welcome to this application designed to scan for Prime Numbers!\n~Q.A.I. (a.k.a Quantum Artificial Intelligense)", L"Run", MB_ICONINFORMATION);
	cout << "Enter a number below and i shall calculate all the prime numbers from up to that number!\n";
	cin >> num;
	prime_num(num);
	cin.get();
	cout << "\nWant to scan for prime numbers again?\n1 for yes, 2 for no.";
	int a;
	cin >> a;
	switch(a){
		case 1:
			printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
			goto prime;
			break;
		default:
			int msg = MessageBox(NULL, L"C'ya!", NULL, NULL);
			goto exit;
			break;
		}
exit:
	return 0;
}

void prime_num(int num){
	bool isPrime = true;
	for (int i = 2; i < num; i++){
		for (int j = 2; j < i; j++){
			if (i % j == 0){
				isPrime = false;
				break;
			}
		}
		if (isPrime){
			cout << i << " is a prime number.\n";
		}
		isPrime = true;
	}
}

Took me awhile to figure out what cause it to print so many lines of the same type..... But it's fixed now :D

Also, i'm also aware of the 'goto' lines, i know that they are bad, but they aren't, as long as it's not a big project.
Topic archived. No new replies allowed.