Fatal error c1083: cannot open include file: 'stdlib ': no such file or directory

Source: Internet
Author: User

I want to learn from the new C ++, so I will look at the <C ++ University tutorial> from the beginning.

 

Run the shuffling example in Chapter 1 and compile several exceptions, such as the question and the header file time. h.

 

Fatal error c1083: cannot open include file: 'stdlib ': no such file or directory

 

In C ++, stdlib should be changed to cstdlib, and time should be changed to ctime.

 

The result is abnormal when the SETW () method is used. It turns out that STD: SETW (INT); W should be in lower case.

 

Record the compiled source program for future reference:

 

# Include <iostream>
# Include <iomanip>
# Include <cstdlib>
# Include <ctime>

Using namespace STD;

Void shuffle (INT [] [13]);

Void deal (const int [] [13], const char * [], const char * []);

Int main (){
Const char * suit [4] = {"Hearts", "diamonds", "clubs", "Spades "};
Const char * face [13] = {"Ace", "Deuce", "three", "four", "five", "Six", "Seven ", "Eight", "Nine", "Ten", "Jack", "Queen", "King "};

Int deck [4] [13] = {0 };

Srand (time (0 ));
Shuffle (deck );
Deal (deck, face, suit );
Return 0;
}

Void shuffle (INT wdeck [] [13]) {
Int row, column;
For (INT card = 1; card <= 52; card ++ ){
Do {
Row = rand () % 4;
Column = rand () % 13;
} While (wdeck [row] [column]! = 0 );
Wdeck [row] [column] = card;
}
}

Void deal (const int wdeck [] [13], const char * wface [], const char * wsuit []) {
For (INT card = 1; card <= 52; card ++ ){
For (int row = 0; row <= 3; row ++ ){
For (INT column = 0; column <= 12; column ++ ){
If (wdeck [row] [column] = card ){
Cout <STD: SETW (5) <setiosflags (IOs: Right)
<Wface [column] <""
<SETW (8) <setiosflags (IOs: left)
<Wsuit [row]
<(Card % 2 = 0? '/N':'/t ');
}
}
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.