Forum Replies Created
- AuthorPosts
- niklaeshParticipant
@Gramdtante wrote:
123void showResult(int res){ <br />cout<<"The result is "<<showResult << endl;<br />}Hello,you are not trying to print the result, as you can see variable res stores the result of the multiplication, but your are printing the result anywhere….You showResult function should look like
1234void showResult(int res){<br />cout<<"The result is "<<res<< endl;<br />}<br />niklaeshParticipantHello
try this code.C++1234567#include <stdio.h>void main(){char* yourName;printf("Please enter your name: ");scanf("%s", yourName);printf("nWelcome %s, I was waiting for you!n", yourName);}As you have declared a pointer which points a character.
char* yourName;
Now you are getting a value from the user and trying to store it in pointer type variable. scanf() function takes the address of the variable i.e. pointer to that variable and store the input. As you have already declared the pointer and you code scanf(“%s”, &yourName); is trying to save that input value in the address of that pointer. Which is logically incorrect. Your code looks fine and no error but it has a logical mistake that is why it compiles fine but gives error at runtime. You code should look like scanf(“%s”, yourName);
niklaeshParticipantHello,
U can make a program that displayes some graphics on the LCD. Or it outputs data using some LAser Light devices.niklaeshParticipantInternet Explorer for web browsing.
Cown Jet-Adio for MP3s music and movies.
Chatting – Yahoo Messenger
Also Gaim for multi yahoo and multi msn sessions
File Compression – WinRAR
niklaeshParticipantAs far as i know, getche() function echos the character on the screen. and getchar() returns teh next character.
When u press Enter Button it returns ASCII value 10 and ASCII value 10 is the orignal n character.
And you know on the STDIO when u press enter button it means a n character.
This is my idea. Any one else migh have the correct answer.niklaeshParticipantBloodrager he didnt mention that he wanted to get input from the user. I made the programme according to the cituation he placed in the post.
Any how thanks for correcting me about “<" ">“, actualy that is mys style of coding. I will try to adopt the changes.
ThanksniklaeshParticipantWhat is ‘Best’ ? In what respect ?
If a user can find one task which can only be done by one but not by the others, then that one is the “best” for that moment, for that user. As always, “The Best Is Yet To Be.” - AuthorPosts