31 May, 2017

First program in C++ language

Here is the first C++ program that will show the "Hello World" output to us.For executing this code on your machine,you have to a compiler that can execute C++ code.Use gcc compiler or other for execute your C++ code.you can use CodeBlock that is a IDE (Integrated Development Environment) provides Editing,Compiling and Executing the codes at one place without suffering.or download the gcc on your machine. I'm using LINUX environment,so for executing this C++ code i am gonna save it with .cpp extension and run the following commands in the saving directory...


g++ demo.cpp -o demo

and after the code being compiled,i am gonna execute that code by following command :


./demo

Here is the C++ code for showing "Hello World" output :

#include <iostream>
using namespace std;
int main()
{
   cout << "Hello World";
   return 0;
}

Solution of URI Online Judge | 1014 Consumption

Hey!! there today we gonna solve a very interesting problem (URI Online Judge | 1014 Consumption). here is the solution of this problem :

  #include<stdio.h>
  int main()
  { 
 int x;
 float y,km_perL;
 scanf("%d %f",&x,&y);
 km_perL=x/y;
 printf("%.3f km/l\n",km_perL);
 
 return 0;
  }