c++ to c converter online
#include
using namespace std;
int main ()
{
int v, w;
cin >> v >> w;
float x = ((4 * v) - w) / 2;
if ((w & 1) || w < 2 || w <= v)
{
cout << "INVALID INPUT";
return 0;
}
cout << "TW=" << x << " " << "FW=" << v - x;
}
c++ to c converter online
#include
#include
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 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: "<
c++ to c converter online
#include
#include
using namespace std;
float timeTaken(float dist, float sp, int totalLaps){
return (dist /sp ) * totalLaps;
}
int main(){
int NumberOfLaps;
float distanceOfOneLap, speed;
string directionOfOneLap;
cout<<"Enter the total of laps: ";
cin>>NumberOfLaps;
cout<<"Enter the distance of one lap: ";
cin>>distanceOfOneLap;
cout<<"Enter the speed of one lap: ";
cin>>speed;
cout<<"Enter the direction. It must N, E, W, or S: ";
cin>>directionOfOneLap;
cout<<"\nTime Taken: "<
c++ to c converter online
#include
using namespace std;
//calculating the distinct years mentioned
int calculateDifferentYears(string str) {
unordered_set differentYears;
string str2 = "";
for (int i = 0; i < str.length(); i++) {
if (isdigit(str[i])) {
str2.push_back(str[i]);
}
if (str[i] == '-') {
str2.clear();
}
if (str2.length() == 4) {
differentYears.insert(str2);
str2.clear();
}
}
return differentYears.size();
}
int main() {
string sentence = "I was born on 22-12-1955."
"My sister was born on 34-06-2003 and my mother on 23-03-1940.";
cout << calculateDifferentYears(sentence);
return 0;
}
c++ to c converter online
#include
#include
using namespace std;
float timeTaken(float dist, float sp, int totalLaps){
return (dist /sp ) * totalLaps;
}
c++ to c converter online
#include
using namespace std;
//calculating the distinct years mentioned
int calculateDifferentYears(string str) {
unordered_set differentYears;
string str2 = "";
for (int i = 0; i < str.length(); i++) {
if (isdigit(str[i])) {
str2.push_back(str[i]);
}
if (str[i] == '-') {
str2.clear();
}
if (str2.length() == 4) {
differentYears.insert(str2);
str2.clear();
}
}
return differentYears.size();
}
int main() {
string sentence = "I was born on 22-12-1955."
"My sister was born on 34-06-2003 and my mother on 23-03-1940.";
cout << calculateDifferentYears(sentence);
return 0;
}
|