First check for the compiler installation as follows on your terminal:
[g++ --version]
if it gives the version of your compiler then run the programs as given below other wise just go through this tutorial:
Installing C/C++ compiler in Ubuntu
Running a c++ program
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello world"<<endl;
}
[g++ --version]
if it gives the version of your compiler then run the programs as given below other wise just go through this tutorial:
Installing C/C++ compiler in Ubuntu
Running a c++ program
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello world"<<endl;
}
Save it as first.cpp on your desktop.
Open the terminal and do as follows.
[g++ Desktop/first.cpp -o Desktop/first.o]
^
first.o will be created if no error occurs
[cd Desktop]
[./first.o]
Running a C program
#include<stdio.h>
//using namespace std;
int main()
{
printf("Hello world\n");
}
Save it as second.c on your Desktop.
[g++ Desktop/second.c -o Desktop/second.o]
[cd Desktop]
[./second.o]
Here you can use gcc or g++ as g++ supports both.
If you have any question then write down the comments,I will be pleased to help you.
Great blog. I am inspired by this blog. Thank you and keep going.
ReplyDeleteC Programming Classes in Coimbatore
C++ Training
Learn C
Learn C Programming
C Programming Course
C Programming Classes
An impressive share! I have just forwarded this onto a coworker who had been conducting a little homework on this technology. And he in fact bought me dinner due to the fact that I found it for him... lol. So allow me to reword this.... Thank YOU for the meal!! But yeah, thanx for spending time to discuss this topic here on your website.
ReplyDeleteThese are really amazing and valuable websites you have shared with us. Thanks for the informative post.really nice post.
ReplyDeleteC and C++ Training Institute in chennai | C and C++ Training Institute in anna nagar | C and C++ Training Institute in omr | C and C++ Training Institute in porur | C and C++ Training Institute in tambaram | C and C++ Training Institute in velachery