I am stil very baby in c++ programming and now i try to make a simple code for my first small programm. This programm was called your_astro. In this programm i want to make a simple astrology information about someone's fortune. So, when someone type a name of astrology, i expect someone will see the information about the astrology that have he/she typed. I made this programm on Ubuntu Linux using c++ compiler gcc version 4.1.2..
I have compiled the source sucsessfuly using comand
Code:
g++ my_astro.cpp -o my_astro
when i run it, first there are no errors, this is the display when i run it at first
Code:
Welcome to my super simple application.
Type your Astro: (aries, pices, libra) just three astro
the problem is, when i type one of the three astros and than hit enter, there are an information which says that
Code:
Segmentation fault (core dumped)
. I still don't know what its mean. So help me to solve this problem, please. How the true source code is.
Your help please, and thaks for your help before.
I'm so sory if my English is bad. ^_^
This is the source code.
Code:
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char* welcome="Welcome to my super simple application.";
char* type="Type your Astro: (aries, pices, libra) just three astro"; /*just 3 astro only now*/
char* did_not_match="Type correctly please, there are just 3 astro";
char* a="aries";
char* b="pices";
char* c="libra";
char* A;
cout<<welcome<<endl<<type<<endl;
cin>>A;
if (A=a){
cout<<"Your astro is ARIES. You are blablabla..."<<endl;
}
else{
cout<<did_not_match<<endl;
}
/* I have not make the next code for the if case above yet.*/
return 0;
}