Installing two computer languages G++ and Ruby

Ok, here we are again. learning how to use some certain programs like C++ and Java,  First we make sure that we are all up to date. with the sudo apt-get update command, then we use sudo apt-get (-y)install g++  the y is there to skip asking the question Y for yes n for no. I always forget it and end up pressing it anyway. installing g++

and now you can use it: I put in hello world,  Thanks Tero for the code  simple code  but first i put in sudoedit hello.cc ( to make sure that it would be saved as a c program, as you can see the various colours showing up on the screen for various commands

#include <iostream>
 
int main()
{
    std::cout << "Hello, world!" << std::endl;
    return 0;
}

helloworld.png

I did use nano to try it first but wouldn’t save so as per above instruction i used sudoedit,  then put in the command

g++ hello.cc -o hello  but got errors.
 
errorc++.png
hello.cc: In function ‘int main()’:
hello.cc:6:1: error: expected primary-expression before ‘return’
 return 0;
 ^
hello.cc:6:1: error: expected ‘;’ before ‘return’
henry@henry-HP-Pavilion-15-Notebook-PC:~$ sudoedit hello.cc
I cant see the error problem.. working on it.

I tried to install basic: sudo apt-get yabasic 
henry@henry-HP-Pavilion-15-Notebook-PC:~$ sudo apt-get install yabasic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package yabasic
henry@henry-HP-Pavilion-15-Notebook-PC:~$ yabasic 
yabasic: command not found
henry@henry-HP-Pavilion-15-Notebook-PC:~$ yabasic 
yabasic: command not found

but as you can see command not found. I have connection but no basic. 


So I'm going to install ruby instead:
rubyfull.png'm going to try Ruby instead,

henry@henry-HP-Pavilion-15-Notebook-PC:~$ ruby 
print ("hello Ruby World!\n")
hello Ruby World!
henry@henry-HP-Pavilion-15-Notebook-PC:~$ 
--It works


Leave a comment