A quick word on blocking ads

It looks like you are using an ad blocker. That's okay. Who doesn't? But without advertising revenue, we can't keep making this site awesome. Click the link below for instructions on disabling adblock.

How to disable ad-blocker for Newschoolers

  • Home
  • News
    • Latest
    • Top Rated
    • Features
    • Podcasts
    • Tags
    • Interviews
    • Event Coverage
    • Opinions
    • Industry News
    • Gear
  • Forums
    • Categories
    • Ski Gabber
    • Non-Ski Gabber
    • Site Discussion
    • Media & Arts
    • Gear
    • Lady Gabber
    • Content Creators
    • AT & Backcountry
    • Regionals
  • Gear
    • Gear Guide 2024-25
    • Gear Guide 2023-24
    • The Roofbox Reviews
    • Editors' Picks
    • Gear Talk
  • Buy/Sell
    • Map View
  • Photos
    • Latest
    • Top Rated
  • Videos
    • Latest
    • Top Rated
    • Ladies
  • Store
  • More
    • Terrain Parks Guide
    • Contests
    • NS Giveaway
    • Top Rated Members
  • Search
  • Login
  • Login

Login to Newschoolers

Register Lost password?

Search Newschoolers

Preview

LOADING...
  • Forums
  • Non-Ski Gabber
  • C++ Coding HELP
  • Reply

Replying to C++ Coding HELP

Iliveinutah:
yes i know this is newschoolers but i know some of you MF are good at coding and im stuck as hell.and all the other compsci forms arent much help with this.

So im making a drinking game for a final project that asks players questions and then checks if the input is the answer to said problem,
I have the questions and answers saved in a 2D array of size 20x2, mathProbs[j]; i being questions j being the answers.
how do I output only questions and then check if the input matches the answer stored? I can output both but I cant get it to output only one without an error, I also need it to step one down the list (array)after each answer.

here is what i got thus far.
C++ language


//*****************************************************
string FileIOthing(){
int prob=0;
int answer=0;
string ans;

string mathProbs[20][2];
ifstream file;
file.open("mathProblems.txt");
if(file.is_open())
{

for(int i = 0; i < 20; i++)
{
for(int j = 0; j < 2; j++)
{
file >> mathProbs[j];
// cout

Click to expand post

Follow Us

Newsletter

Subscribe to our newsletter and stay up-to-date with the latest news from Newschoolers and our partners

Subscribe
Register Contact Advertise Privacy Policy Terms of Use
Newschoolers has affiliate partnerships so we may receive compensation for some links to products and services.
© 2025 NEWSCHOOLERS, INC.
NEWSCHOOLERS is a registered trademark of NEWSCHOOLERS, INC.
  • Bike
  • Fantasy Surfer
  • Newschoolers
  • Powder
  • Ridemonkey
  • Snowboarder
  • Surfer
  • TransWorld Skateboarding