C++ flowchart
Hello. I have to draw a flowchart of C++ program. We did not do this on classes, so I have no idea how to do that. Here's the program:
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
|
#include "stdafx.h"
using namespace System;
using namespace System::IO;
int main(array<System::String ^> ^args)
{
String^ readFileName = "start.txt";
String^ writeFileName = "exit.txt";
int n, x = 0, ile, j, max = 0, k, l_max;
StreamReader^ din = File::OpenText(readFileName);
n = int::Parse(din->ReadLine());
Console::WriteLine("I'm looking for the biggest highly composite number in the range: (0,{0})", n);
for (k = 1; k <= n; k++)
{
ile = 0;
j = 1;
while (j * j < k)
{
if (k % j == 0)
ile += 2;
j++;
}
if (j * j == k)
ile++;
if (ile > max)
{
++x;
max = ile;
l_max = k;
}
}
Console::WriteLine(" The biggest highly composite number: {0}.", l_max);
StreamWriter^ sw = gcnew StreamWriter(writeFileName);
sw->WriteLine("{0}",l_max);
sw->Close();
Console::ReadKey();
return 0;
}
|
I tried to do it by myself, but I think it does not make sence at all.
http://oi60.tinypic.com/1z6gig5.jpg I would be grateful for any help.
Last edited on
I don't know much about C++/CLI i'm afraid (as what you've posted isn't really C++), but I can't see any GUI elements in your code?
Topic archived. No new replies allowed.