Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Need help with a simple C++ interaction


  • This topic is locked This topic is locked
1 reply to this topic

#1 joltnyx

joltnyx

  • Members
  • 5 posts
  • OFFLINE
  •  
  • Local time:02:37 PM

Posted 18 November 2008 - 03:10 AM

Hello, can someone help me with this code? We're supposed to practice the basics of C++.
This program sould be a Q&A between the computer and the user.
The computer then uses the user's input as basis for the next question/comment.

[codebox]/*Computer AI*/
#include <stdio.h>
#include <conio.h>
#include <math.h>

main()

{/*start of program*/

float a;
char nickname;
clrscr();

printf ("What's your name?");
scanf ("%s", &nickname);
printf ("Hello %s.", &nickname);
printf ("\nHow old are you?");
scanf ("%f", &a);
printf ("you're %f yrs old?", &a);

getch();
return(0);

}[/codebox]

if you run it and entered your FULL NAME it wont output the correct information :thumbsup:
so can someone help me?? thanks in advance.

BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:12:37 AM

Posted 18 November 2008 - 07:04 AM

I hate to do this, but this is such a simple assignment, and you are really, really close. I have to lock this, otherwise someone is going to just tell you the answer, and that will not help you. You are very close though.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users