Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

dsdaddadadasdadasafgdfFEW

#include <iostream>

using namespace std;

int main()
{
   cout << "Hello World" << endl; 
   
   return 0;
}

Compile and Execute C++11 Online

//File: TimeAppl.cpp  Time Class Application File
#include "Time.h"
#include "Time.cpp"
#include <iostream>
using namespace std;
int main()
{
	Time t1 , t2;
	cout << "Start Time is: "; 	t1.displayTime();
	t2.setTime(5, 10, 30);
	cout << "End Time is: ";	t2.displayTime();
	return 0;
} 

temperaturetokelvinandcelcius.cpp

/* Program will ask user to input temperature in  fahrenheit and 
*convert it to celcius and kelvin
*By: Destiny Muldrow
*/
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
  //set the variables (constant is used to convert to kelvin)  
  const double DIFFERENCE = 273.15;
  double fahrenheit;
  double celcius;
  double kelvin;
  
  //asks user for the temperature in fahrenhheit
  cout << "Enter temperature in fahrenheit: ";
  cin >> fahrenheit;
  
  //calculate how to convert fahrenheit to celcius and kelvin
  celcius = (fahrenheit - 32) / 1.8;
  kelvin = celcius + DIFFERENCE; 
  
  //sets the decimal place to three places over
  cout << fixed << setprecision(3);
  
  //output the temperature in celcius and kelvin
  cout << "Temperature in celsius is: " <<  celcius << endl;
  cout << "Temperature  in kelvin is: " << kelvin << endl;
   
  return 0;
}

switch vs else if

#include <iostream>
using namespace std;
int main()
{
   char g = 'B';
   cout << "use switch\n";
   switch (g) {
       case 'A': cout << "\t80+\n"; break;
       case 'B': cout << "\t70 .. 79\n"; break;
       case 'c':                    // no break, continue to next statement
       case 'C': cout << "\t60 .. 69\n"; break;
       default : cout << "very sorry\n";
   }
   cout << "use if" << endl;
   if (g == 'A') cout << "\t80+\n";
   else if (g == 'B') cout << "\t70 .. 79\n";
   else if (g == 'C' or g == 'c') cout << "\t60 .. 69\n";   // or is the same as ||
   else cout << "very sorry\n";
   return 0;
}

statickeywordtestngandshowering

#include <iostream>

using namespace std;

void f(void)
{
    static int i = 0;
    
    cout << i << endl;
    
    i++;
}


int main()
{
   cout << "Hello World" << endl; 
   
   for (int i = 0; i < 10; i++)
    f();
   
   return 0;
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.