Note that there are some explanatory texts on larger screens.

plurals
  1. PONot understanding why I'm getting error message
    text
    copied!<p>I coded this program and I been looking on it for the last two hours before coming here. I get the error message <strong>Function or variable unsafe consider using strcpy_s</strong> my book says nothing about strcpy_s. Maybe a fresh set of eye's will see what I don't see. here is the code I wrote</p> <pre><code> #include "stdafx.h" #include &lt;iostream&gt; #include &lt;iomanip&gt; #include &lt;string&gt; using namespace std; class HotelRoom { private: char room_no [3]; char* guest; int capacity; int occupancy; double rate; public: HotelRoom(char room[],int, double = 89.00, char* n_p = 0, int= 0); ~HotelRoom(); void Display_get_number(); void Display_guest(); int get_capacity(); int get_status(); double get_rate(); void change_rate(double); bool change_status(int); }; HotelRoom::HotelRoom (char room[], int cap, double rt, char*n_p, int occup) { strcpy(room_no, room); guest = new char[strlen(n_p) + 1]; strcpy(guest, n_p); capacity = cap; occupancy = occup; rate = rt; cout &lt;&lt; " defaut for the following " &lt;&lt; room &lt;&lt; endl &lt;&lt; endl; cout &lt;&lt; " Capacity " &lt;&lt; capacity &lt;&lt; endl &lt;&lt; endl; cout &lt;&lt; " rate " &lt;&lt; rate &lt;&lt; endl &lt;&lt; endl; cout &lt;&lt; " Room Guest " &lt;&lt; guest &lt;&lt; endl &lt;&lt; endl; cout &lt;&lt; " Occupancy " &lt;&lt; occupancy &lt;&lt; endl &lt;&lt; endl; } HotelRoom::~HotelRoom() { cout &lt;&lt; "\nHotelRoom " &lt;&lt; room_no &lt;&lt;" terminated. "; delete [] guest; } void HotelRoom::Display_get_number() { cout &lt;&lt; room_no; } void HotelRoom::Display_guest() { cout &lt;&lt; guest; } int HotelRoom::get_capacity() { return capacity; } int HotelRoom::get_status() { return occupancy; } double HotelRoom::get_rate() { return rate; } void HotelRoom::change_rate( double amount) { rate += amount; } bool HotelRoom::change_status(int occupancy) { if (occupancy &lt;= capacity ) { this-&gt; occupancy = occupancy; return true; } else return false; } int _tmain(int argc, _TCHAR* argv[]) { cout &lt;&lt; setprecision(2) &lt;&lt; setiosflags(ios::fixed) &lt;&lt; setiosflags(ios::showpoint); HotelRoom guest ("134",4,0, "Dennard Beale", 0); cout &lt;&lt; endl; cout &lt;&lt; " *****End of program***** " &lt;&lt; endl; system("pause"); return 0; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload