Answers for "c++ code"

C++
7

how to code in c++

help me i dont now what the freak am doing any more
Posted by: Guest on November-28-2020
3

basic cpp programs

// Your First C++ Program

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
Posted by: Guest on May-15-2020
2

c++ basic code

#include <iostream>
#include<conio.h> /* For getch() only */
using namespace std;
int main () {
   int num = 10;
            if (num % 2 == 0)
            {
                cout<<"It is an even number";
            }
getch();  /* getch is the function of conio.h */
}
Posted by: Guest on September-03-2021
0

c++ code

#include <bits/stdc++.h>
using namespace std;

long int getSumOfFactors(int n)
{
    long int temp = 0;
    for (int i=1;i<=n;i++){
        if (n%i==0) temp = temp+i;
    }
    return temp;
}

int main()
{
    int n;

    cout<<"Input the number : ";
    cin>>n;

    long int result = getSumOfFactors(n);

    cout<<"\nThe Summation of the all the factors of the number is : "<<result;

}
Posted by: Guest on May-23-2021
0

c++ code

#include<bits/stdc++.h>
using namespace std;
int
main ()
{
  string s1, s2;
  cin >> s1 >> s2;
  cout << s1.size () << " " << s2.size () << endl;
  cout << s1 << s2 << endl;
  char temp;
  temp = s1[0];
  s1[0] = s2[0];
  s2[0] = temp;
  cout << s1 << " " << s2 << endl;
}
Posted by: Guest on May-27-2021

Browse Popular Code Answers by Language