Click here to Skip to main content
15,887,683 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer14-Jun-16 6:06
leon de boer14-Jun-16 6:06 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer14-Jun-16 10:01
leon de boer14-Jun-16 10:01 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed114-Jun-16 20:34
Hassan Syed114-Jun-16 20:34 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 3:53
leon de boer15-Jun-16 3:53 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed115-Jun-16 4:32
Hassan Syed115-Jun-16 4:32 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 6:21
leon de boer15-Jun-16 6:21 
GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed115-Jun-16 7:01
Hassan Syed115-Jun-16 7:01 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 8:04
leon de boer15-Jun-16 8:04 
We all get stuck at times Smile | :) It is really pleasing to see you are willing to apply yourself to learn. None of us are born able to think like a programmer it is like any profession something you get good at by application of lots of time and effort.

Your long single file code is sort of normal basic student level code, it works in a fashion. You are now seeking to move beyond that and I can only encourage that. All I did was really shorten up your code by making functions with more parameters and putting in error checking for things like typing letters instead of numbers etc. There are improvements you could do by using objects or classes but that is more stuff you are yet to learn.

I looked up the problem with scanf_s it is they have changed security with this, you now need to use "%hu" rather than "%u" as meaning a pointer to an unsigned short. That tells you how many years since I have written code for a console application Smile | :)

So there are two fixes to remove the warning correctly
unsigned short iResult;   // Define iResult as unsigned short not unsigned int

int err = scanf_s("%hu", &iResult);   // Use %hu this should be error free on GCC

In vino veritas


modified 15-Jun-16 14:35pm.

GeneralRe: Large project how to seprate definition and declaration? Pin
Hassan Syed115-Jun-16 8:48
Hassan Syed115-Jun-16 8:48 
GeneralRe: Large project how to seprate definition and declaration? Pin
leon de boer15-Jun-16 20:00
leon de boer15-Jun-16 20:00 
QuestionGlut errors with Mingw on windows Pin
Ratul Thakur11-Jun-16 7:03
Ratul Thakur11-Jun-16 7:03 
AnswerRe: Glut errors with Mingw on windows Pin
Ratul Thakur11-Jun-16 20:02
Ratul Thakur11-Jun-16 20:02 
GeneralRe: Glut errors with Mingw on windows Pin
leon de boer11-Jun-16 22:59
leon de boer11-Jun-16 22:59 
GeneralRe: Glut errors with Mingw on windows Pin
Ratul Thakur11-Jun-16 23:59
Ratul Thakur11-Jun-16 23:59 
QuestionWhy no boundry condition set for C++ Pin
Hassan Syed111-Jun-16 4:52
Hassan Syed111-Jun-16 4:52 
AnswerRe: Why no boundry condition set for C++ Pin
Richard MacCutchan11-Jun-16 5:08
mveRichard MacCutchan11-Jun-16 5:08 
GeneralRe: Why no boundry condition set for C++ Pin
Hassan Syed111-Jun-16 5:27
Hassan Syed111-Jun-16 5:27 
AnswerRe: Why no boundry condition set for C++ Pin
Patrice T11-Jun-16 6:02
mvePatrice T11-Jun-16 6:02 
AnswerRe: Why no boundry condition set for C++ Pin
leon de boer11-Jun-16 22:53
leon de boer11-Jun-16 22:53 
AnswerRe: Why no boundry condition set for C++ Pin
enhzflep14-Jun-16 1:34
enhzflep14-Jun-16 1:34 
AnswerRe: Why no boundry condition set for C++ Pin
Maximilien14-Jun-16 10:25
Maximilien14-Jun-16 10:25 
QuestionConverting Fortran source to C++ Source Pin
manoharbalu9-Jun-16 1:58
manoharbalu9-Jun-16 1:58 
AnswerRe: Converting Fortran source to C++ Source Pin
Jochen Arndt9-Jun-16 2:30
professionalJochen Arndt9-Jun-16 2:30 
GeneralRe: Converting Fortran source to C++ Source Pin
manoharbalu9-Jun-16 2:52
manoharbalu9-Jun-16 2:52 
GeneralRe: Converting Fortran source to C++ Source Pin
Jochen Arndt9-Jun-16 3:27
professionalJochen Arndt9-Jun-16 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.