Click here to Skip to main content
14,971,280 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C++
#include <conio.h>
#include <iostream>
using namespace std;
int n_prime(int n_last);
int main(int argc, char *argv[])
{
int your_num;
cout"Enter No= ";
cin>>your_num;
cout n_prime(your_num);
system("PAUSE");
return EXIT_SUCCESS;
}
int n_prime(int n_last){
int count,x;
count=0;
for(x=2;x<=n_last/2;x++){
if(n_last%x==0){
count++;
break;
}
}
if(count==0){
cout"Prime"endl;
}else{
cout"Composite"endl;
}
}
{
public:
Stack() { size = 10; current = -1;} //constructor
int pop(){ return A[current--];} // The pop function
void push(int x){A[++current] = x;} // The push function
int top(){ return A[current];} // The top function
int isEmpty(){return ( current == -1 );} // Will return true when stack is empty
int isFull(){ return ( current == size-1);} // Will return true when stack is full
{
1. int x = head->get();
2. Node * p = head;
3. head = head->getNext();
4. delete p;
5. return x;
}
void push(int x)
{
1. Node * newNode = new Node();
2. newNode->set(x);
3. newNode->setNext(head);
4. head = newNode;
}</iostream></conio.h>
Posted
Updated 16-Nov-14 4:26am
v2
Comments
OriginalGriff 16-Nov-14 10:27am
   
Convert to what?
Kornfeld Eliyahu Peter 16-Nov-14 10:29am
   
To ham-and-egg sandwich of course!
OriginalGriff 16-Nov-14 10:39am
   
Is that Kosher? :laugh:
[no name] 16-Nov-14 11:11am
   
Sounds/reads like the successors of Monty Python :laugh:
Sergey Alexandrovich Kryukov 16-Nov-14 12:30pm
   
Great exchange of comments, guys. You made my day!
—SA
[no name] 16-Nov-14 12:38pm
   
Sergey please help me to make my day :-)
Observer pattern, non cooperative subscriber[^]
Thanks, Bruno
[no name] 16-Nov-14 10:28am
   
To what you like to convert it?
In worst case, one possibilty is cmd: copy *.cpp nul ;) sorry don't take that serious.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900