Search
 
SCRIPT & CODE EXAMPLE
 

CPP

convert c to C language

#include <iostream>
#include <queue>
using namespace std;
struct Node{
   int data;
   struct Node* left, *right;
};
// Function to count the full Nodes in a binary tree
int fullcount(struct Node* node){
   // Check if tree is empty
   if (!node){
      return 0;
   }  
   queue<Node *> myqueue;
   // traverse using level order traversing
   int result = 0;
   myqueue.push(node);
   while (!myqueue.empty()){
      struct Node *temp = myqueue.front();
      myqueue.pop();
      if (temp->left && temp->right){
         result++;
      }
      if (temp->left != NULL){
         myqueue.push(temp->left);
      }
      if (temp->right != NULL){
         myqueue.push(temp->right);
      }
   }
   return result;
}
struct Node* newNode(int data){
   struct Node* node = new Node;
   node->data = data;
   node->left = node->right = NULL;
   return (node);
}
int main(void){
   struct Node *root = newNode(10);
   root->left = newNode(20);
   root->right = newNode(30);
   root->left->left = newNode(40);
   root->left->right = newNode(50);
   root->left->left->right = newNode(60);
   root->left->right->right = newNode(70);
   cout <<"count is: "<<fullcount(root);
   return 0;
}
Comment

convert in c

#include<iostream>
#include<string>
using namespace std;

int main()
{
   int n,k,ans,t1;
   cin>>n>>k;
   ans=240-k;
   for(int i=1;i<=n;i++)
   {
       ans-=(i*5);
       if(ans<0)
       {
           t1=i-1;break;
       }
   }
   if(ans>=0)
   {cout<<n<<endl;}
   else {cout<<t1<<endl;}

return 0;
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Comment

PREVIOUS NEXT
Code Example
Cpp :: run a c++ file in terminal 
Cpp :: c++ How to not use friend declaration when equipping a class with `operator<<` 
Cpp :: MPI_Sendrecv 
Cpp :: convert preorder to postorder calculator 
Cpp :: type defination in C++ 
Cpp :: ala vida 
Cpp :: number triangle c++ 
Cpp :: c + + to c converter 
Cpp :: std::throw_with_nested 
Cpp :: what is imposter syndrome 
Cpp :: vector übergeben c++ 
Cpp :: c++ copy pointer vector to static 
Cpp :: What will be the values of variables p, q and i at the end of following loop? int p = 5; int q = 18; for(int i=1;i&lt;5;i++) p++; --q; 
Cpp :: run c++ files on chrome book 
Cpp :: convert c++ program to c online 
Cpp :: how to read qlistwidget in c++ 
Cpp :: kruskal algorithm in c++ 
Cpp :: initializer before void c++ 
Cpp :: Chef and Feedback codechef solution in cpp 
Cpp :: c++ max 
Cpp :: c++ is nan 
Cpp :: if statement in c++ 
Cpp :: how to change the type of something in c++ 
Cpp :: declaring multiple variables in cpp 
Cpp :: c++ short hand if else 
C :: sleep in c programming 
C :: find factors of a number in c 
C :: printf boo; 
C :: how to open jupyter notebook in local disk D 
C :: how to find sum of two nums 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =