Welcome to the gastroenterology community! It is extrememly unlikely that you have colon cancer. I have no idea why the doctor would have told you this. It sounds like you might have IBS.
It seems unlikely that you would have colon cancer as you are so young. My brother developed colitis in his twenties, however, the symptoms were incredibly severe, nothing like you've described. The only way to be 100 percent sure is a colonoscopy - the gold standard apparently.
A fecal occult blood test may be helpful. A fecal occult blood test will see if you are regularly bleeding from your intestines - however, you could have internal hemorrhoids or fissures depending on how much you've had to strain due to constipation.
You could also ask your doc to do an anoscopy in the office to see of he/she can see any hemorrhoids further up in your rectum. An anoscopy is an examination using a small, rigid, tubular instrument called an anoscope (also called an anal speculum). This is inserted a few inches into to the anus in order to evaluate problems of the anal canal. Anoscopy is used to diagnose hemorrhoids, anal fissures (tears in the lining of the anus), and some cancers.