A Problem With Processes in C++ 
<p>I'm writing a program that contains two processes. One process gets two numbers from input, and add them together. The second process shows the added result.</p>

<p>The problem is it can't get number from input.</p>

<pre><code>#include &lt;sys/types.h&gt;
#include &lt;unistd.h&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
using namespace std;
int a,b,c=1;
bool res = false;
void Add(){
if(res==true){
c=a+b;
cout&lt;&lt;"Process 1 was done !\n";
cout&lt;&lt;c&lt;&lt;endl;}
}
void Print(){
if(c!=1){
cout&lt;&lt;c&lt;&lt;endl;
cout&lt;&lt;"Process 2 was done !\n";}
}


int main(){
cout&lt;&lt;"Enter a,b :\n";
cin&gt;&gt;a&gt;&gt;b;
res= true;
pid_t pid;
pid  = fork();
if(pid==0)
Print();
else
Add();

return 0;}
</code></pre>

<p>Running on Ubuntu.</p>
