Hey, all. I am wondering how to get rid of an error in my poker game. It's called, 1>------ Build started: Project: Poker (no gambling), Configuration: Debug Win32 ------
1> Poker (no gambling).cpp
1>Poker (no gambling).cpp(30): error C2001: newline in constant
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I use Visual C++ 2010 Express, and I'm wondering about this one bug that's been getting me. Oh, and here's my code:
// Poker - Game to involve poker
#include <StdAfx.h>
#include <iostream>
using namespace std;
int main()
{
// say a welcome (followed by a NewLine)
;cout << "Welcome to Poker! Please type your name, and use 5 cards only, please!\n"
// give input
;int input;
;cin >> input;
// say the name inputted
;int end1;
;cout << "Okay:"
;int q
;cout << q << end1;
// clear screen
;system("CLS")
;cout << "What cards would you like? Type here:"
// give the user input for the cards they are going to
// type
;int ok2
;cin >> ok2
// give the output
;cout << "Okay, 5 cards of:
;int ok3;
;cout << ok3 << end1;
// ask the user
// for what bet they'd like
;cout << "What bet do you want? Type here:\n"
;int nValue1
;cin >> nValue1
;system("PAUSE")
;system("CLS")
;cout << "Ok:"
;cout << nValue1 << end1;
// tell the user
// the computer's bet
;cout << "Computer has a Royal Flush!"
;system("PAUSE")
;system("CLS")
// tell the results
;cout << "The computer has won or tied!"
;end1
// wait until user is ready before terminating program
// to allow the user to see the program results
;system("PAUSE")
;return 0;
}
I am a little new to console programs and just wondering how to do this.
Thank you all,
cppcoolnet
First, welcome to the forum. Next time, please use the format <> tag to properly format your code. Also, you came from another language that used a semicolon to tell the compiler it's the start of a new line. You don't need to do that in C++, and is highly suggested that you don't. You'll get error codes, much like the one you got, that isn't typically seen.
This line: ;cout << "Computer has a Royal Flush!"
Is missing a semicolon at the end of it.