string comparison

Ask a user to enter three strings of characters and store them in three different arrays of characters. Then print them out according to their alphabetical order.
Nah.
In other words:
"We won't do the assignment for you. What have you started with? After starting, you may ask us questions if you need further help. If you do not ask or provide any information other than copy/pasting the assignment you will get no help."
yea sorry. i'm just getting a bit sick of typing it. Maybe I should have that paragraph in a text file or something? Ready to copy and paste?
I did tried to work it out but I'm not getting the right solution, here is what I got:
#include<iostream>
#include<iomanip>
#include<ctime>
using namespace std;
int tossingcoin ();
int main()
{
srand (time((0));
int n=0, h=0, i=0, j=0, k=0;
int a[13]={0};
cout<<"How many times do you want to conduct experment?\n";
cin>>n;
for(i=0; i<n; i++)
{
int h=tossingcoin();
if(h==0)
a[0]++;
else if(h==1)
a[1]++;
else if(h==2)
a[2]++;
else if(h==3)
a[3]++;
else if(h==4)
a[4]++;
else if(h==5)
a[5]++;
else if(h==6)
a[6]++;
else if(h==7)
a[7]++;
else if(h==8)
a[8]++;
else if(h==9)
a[9]++;
else if(h==10)
a[10]++;
else if(h==11)
a[11]++;
else if(h==12)
a[12]++;
else
cout<<"Error!"<<endl;
}
for(k=0;k<13;k++){
cout<<left;
cout<<"\n"<<setw(4)<<k<<" ";
for(i=0;i<a[k];i++)
cout<<"*";
Please use code tags when posting code, to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/

And what does that code have to do with your question? It looks like something completely different.
Last edited on
Topic archived. No new replies allowed.