i'm new to c++ so sorry if this question is really simple.i'm writing a program in c++ that rolls a dice and shows it's number until the user types the word cancel but my loop doesn't end even though i type cancel.here is my code(i use dev c++):
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int dice (int);
int main()
{
char k[7];
int x;
do
{
cout<<"your dice number is: "<<dice(x)<<endl;
cout<<"do you want to cancel or continue?";
cin>>k;
}while(k!="cancel");
cout<<"END";
getch();
}
int dice (int a)
{
srand(time(NULL));
for(int i=1;i<100;i++)
{
a=(rand()% 6)+1;
}
return a;
}