Question: How to Write this code for Pseudo Code for c++ ? ----------------------------------------------------------------------------------------------- #include stdafx.h #include #include #include using namespace std; //Function prototype bool isPrime(int); //Main
How to Write this code for Pseudo Code for c++ ?
-----------------------------------------------------------------------------------------------
#include "stdafx.h" #include
using namespace std;
//Function prototype bool isPrime(int);
//Main function int _tmain(int argc, _TCHAR* argv[]) { int num; int currNum, count;
//Opening file fstream fout("PrimeOut.txt", ios::out);
//Verifying file opening status if(fout.fail()) { cout
//Reading a number cout > num;
//Validating number while(num 100) { //Reading a number cout > num; }
//Initializing values count = 0; currNum = 2;
cout
//Iterating loop till count reaches the number while(count
//Printing prime number to file fout
//Incrementing count count++; }
//Checking for ten numbers if(count % 10 == 0) { //If there are ten numbers, print new line cout
//Incrementing current number currNum++; }
//Closing file fout.close();
cout
system("PAUSE");
return 0; }
//Function that checks for prime number bool isPrime(int n) { int k;
//Iterating from 2 to 1 less than the number for(k = 2; k
//If k is equal to n, it is a prime number if ( k == n ) return true; else return false; }

Sample Output Primeout.tct X bly prime File.cpp 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 Cluserstsaibabuldocumentslvisual studio 2010ProjectsWprimeFileVDebuglprimeFile. Enter a number (1 100) 25 5 7 11 13 17 19 23 29 31 37 41 43 53 59 61 67 71 73 79 83 89 97 Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
