Click here to Skip to main content
15,886,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: execution time of function increases Pin
ThatsAlok24-May-09 18:38
ThatsAlok24-May-09 18:38 
GeneralRe: execution time of function increases Pin
Hamid_RT25-May-09 0:53
Hamid_RT25-May-09 0:53 
GeneralRe: execution time of function increases Pin
ThatsAlok25-May-09 3:33
ThatsAlok25-May-09 3:33 
QuestionGet active user's desktop resolution from system account. Pin
«_Superman_»22-May-09 16:39
professional«_Superman_»22-May-09 16:39 
AnswerRe: Get active user's desktop resolution from system account. Pin
Garth J Lancaster22-May-09 20:09
professionalGarth J Lancaster22-May-09 20:09 
QuestionMenu and Icon's Pin
BobInNJ22-May-09 11:18
BobInNJ22-May-09 11:18 
AnswerRe: Menu and Icon's Pin
Stuart Dootson22-May-09 11:41
professionalStuart Dootson22-May-09 11:41 
QuestionNeed Help Debugging Program Pin
Ryuk199022-May-09 11:10
Ryuk199022-May-09 11:10 
I have Visual Studio 2005. I'm doing some console programming and developing a virtual computer store. I have a few problems.

1.) Why do I get these warnings?
Warning 1 warning C4996: 'strcat' was declared deprecated f:\testing\testing\testing.cpp 22
Warning 2 warning C4996: 'strcpy' was declared deprecated f:\testing\testing\testing.cpp 26

2.) You have to enter a password in the beginning of the program in order to access the store. I have it set up so that it tells the user that the password is incorrect. It used to display that if the user did indeed put in the wrong password but it would still let the user move onto the store. So to stop that, I added the line "return 0;" in the else condition. The problem is that it now exits out of the program without even letting the user see that the password was incorrect. What would be a better solution?

3.) I've noticed that in the first question if my if condition is true, it still moves onto my switch method question. I want it to stop.

Here is my code:
#include "stdafx.h"
#include "iostream"

using namespace std;

int main(){
	
	char Password[50];
	int a;
	int b;
	int c;
	int d;
	
cout << "Type in the password to enter this promotional store of great savings.\n";
cin.getline(Password,50,'\n');

if (!strcmp(Password,"savings"))
{
	strcat(Password," is the correct password!\n");
}
else
{
	strcpy(Password,"That's not the correct password!\n");
	return 0;
}

cout << Password;

	cout << "Welcome to PC Warehouse\nHow much are you willing to spend?\n";
cin >> a;

	if (a < 800){
		cout << "Get out!\n";}
	else {
		cout << "How much RAM?\n";
	cin >> b;}
	
	if (b < 512){
		cout << "I hope you're not planning on running Vista!\n";}
	else {
		cout << "Ok...how much HDD space?\n";
		cin >> c;}
	
	cout << "Ok, which videocard do you want?(Enter the number)\n1 Radeon X1600\n2 GeForce 8800\n3 Radeon HD 2600 XT\n";
	cin >> d;
	
	switch (d){
	
case 1: 
		cout << "Going cheap, no problem.\n";
		break;
	
case 2: 
		cout << "Now we're talking...\n";
		break;
	
case 3: 
		cout << "ooooof, you're going to need some power\n";
		break;
	
default: 
		cout << "Invalid answer. Type in only the number of the corresponding videocard!\n";
		break;
	}

	
	
	system("pause");
}	

AnswerRe: Need Help Debugging Program Pin
BobInNJ22-May-09 11:26
BobInNJ22-May-09 11:26 
AnswerRe: Need Help Debugging Program Pin
Stuart Dootson22-May-09 11:33
professionalStuart Dootson22-May-09 11:33 
QuestionViewing Design Pin
Ryuk199022-May-09 10:20
Ryuk199022-May-09 10:20 
AnswerRe: Viewing Design Pin
Stuart Dootson22-May-09 10:34
professionalStuart Dootson22-May-09 10:34 
GeneralRe: Viewing Design Pin
Ryuk199022-May-09 11:13
Ryuk199022-May-09 11:13 
QuestionAlgoritm in C Pin
cstic22-May-09 9:47
cstic22-May-09 9:47 
AnswerRe: Algoritm in C Pin
Garth J Lancaster22-May-09 18:17
professionalGarth J Lancaster22-May-09 18:17 
QuestionGlobal Keyboard hook works for a few seconds... Pin
mcfonseca22-May-09 7:58
mcfonseca22-May-09 7:58 
Questionprogress bar created in the status bar turns up uncovered the pane Pin
HelloDan200922-May-09 7:27
HelloDan200922-May-09 7:27 
QuestionDoes Postmessage/SendMessage require a Message Map entries Pin
ForNow22-May-09 6:38
ForNow22-May-09 6:38 
AnswerRe: Does Postmessage/SendMessage require a Message Map entries Pin
led mike22-May-09 8:37
led mike22-May-09 8:37 
GeneralRe: Does Postmessage/SendMessage require a Message Map entries Pin
ForNow22-May-09 10:50
ForNow22-May-09 10:50 
GeneralRe: Does Postmessage/SendMessage require a Message Map entries Pin
«_Superman_»22-May-09 16:21
professional«_Superman_»22-May-09 16:21 
GeneralRe: Does Postmessage/SendMessage require a Message Map entries Pin
ForNow23-May-09 15:33
ForNow23-May-09 15:33 
QuestionGPS & GoogleMap matching Pin
yunpil22-May-09 5:17
yunpil22-May-09 5:17 
AnswerRe: GPS & GoogleMap matching Pin
Stuart Dootson22-May-09 6:33
professionalStuart Dootson22-May-09 6:33 
RantRe: GPS & GoogleMap matching Pin
Rajesh R Subramanian23-May-09 0:39
professionalRajesh R Subramanian23-May-09 0:39 

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.