Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,671 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,184 people online right now. Registration is fast and FREE... Join Now!




How Can I Translate dis One in C?

2 Pages V  1 2 >  
Reply to this topicStart new topic

How Can I Translate dis One in C?, iN C

arem026
post 30 Aug, 2007 - 07:31 PM
Post #1


New D.I.C Head

*
Joined: 28 Aug, 2007
Posts: 22


My Contributions


hey guys its me again...
as usual i have a program that i can't work on hope you can help me...

Create a program that let the user to input username and password
if the password or the username is wrong it will display "wrong input" if correct it will display "correct"...

our prof said that our:
username is : bunyi
password is : conti



thats it guys...
send me your codes...
tnx... co coders
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 30 Aug, 2007 - 07:32 PM
Post #2


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,354



Thanked 58 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


QUOTE(arem026 @ 30 Aug, 2007 - 08:31 PM) *

hey guys its me again...
as usual i have a program that i can't work on hope you can help me...

Create a program that let the user to input username and password
if the password or the username is wrong it will display "wrong input" if correct it will display "correct"...

our prof said that our:
username is : bunyi
password is : conti



thats it guys...
send me your codes...
tnx... co coders

By chance did your professor also assing you reading material... from a book?
User is offlineProfile CardPM

Go to the top of the page

arem026
post 30 Aug, 2007 - 07:39 PM
Post #3


New D.I.C Head

*
Joined: 28 Aug, 2007
Posts: 22


My Contributions


nope
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 30 Aug, 2007 - 07:42 PM
Post #4


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,354



Thanked 58 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


QUOTE(arem026 @ 30 Aug, 2007 - 08:39 PM) *

nope

Then how are you learning material when you are in school?
User is offlineProfile CardPM

Go to the top of the page

arem026
post 30 Aug, 2007 - 07:46 PM
Post #5


New D.I.C Head

*
Joined: 28 Aug, 2007
Posts: 22


My Contributions


QUOTE(no2pencil @ 30 Aug, 2007 - 08:42 PM) *

QUOTE(arem026 @ 30 Aug, 2007 - 08:39 PM) *

nope

Then how are you learning material when you are in school?


we dont have a book in this subject he only discuss this like this by lecturedifficult nho?
User is offlineProfile CardPM

Go to the top of the page

arem026
post 30 Aug, 2007 - 07:58 PM
Post #6


New D.I.C Head

*
Joined: 28 Aug, 2007
Posts: 22


My Contributions


translating this to C:
CODE

#include <iostream>
#include <string>

using namespace std;

int main() {
  string user="USER",pass="PASS";
  string username;
  string password;

  cout<<"Welcome to the simple login scheme, please enter username and password";
  cin>>username;
  cin>>password;
  if (user==username && pass==password)
   {
     cout<<"Successful Log-in";
     }
  else {
     cout<<"Please try again";
     }
}
User is offlineProfile CardPM

Go to the top of the page

Xing
post 30 Aug, 2007 - 08:24 PM
Post #7


D.I.C Addict

Group Icon
Joined: 22 Jul, 2006
Posts: 723



Thanked 2 times

Dream Kudos: 1575
My Contributions


Read about C-style strings & Manipulating C strings using string.h
http://www.cprogramming.com/tutorial/c/lesson9.html
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 30 Aug, 2007 - 08:33 PM
Post #8


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 8,933



Thanked 118 times

Dream Kudos: 8525

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions


QUOTE(arem026 @ 30 Aug, 2007 - 08:31 PM) *

hey guys its me again...
as usual i have a program that i can't work on hope you can help me...

Create a program that let the user to input username and password
if the password or the username is wrong it will display "wrong input" if correct it will display "correct"...

our prof said that our:
username is : bunyi
password is : conti



thats it guys...
send me your codes...
tnx... co coders


I'm really sorry but I truly doubt anyone here is going to do your homework for you, thats not what </dream.in.code>'s all about. This community is about helping fellow programmers with their difficulties, asking someone to create your application then give you the code doesn't fall into this category.
User is offlineProfile CardPM

Go to the top of the page

musya
post 30 Aug, 2007 - 10:03 PM
Post #9


D.I.C Regular

Group Icon
Joined: 25 Apr, 2007
Posts: 291



Thanked 1 times

Dream Kudos: 50
My Contributions


QUOTE(PsychoCoder @ 30 Aug, 2007 - 09:33 PM) *

QUOTE(arem026 @ 30 Aug, 2007 - 08:31 PM) *

hey guys its me again...
as usual i have a program that i can't work on hope you can help me...

Create a program that let the user to input username and password
if the password or the username is wrong it will display "wrong input" if correct it will display "correct"...

our prof said that our:
username is : bunyi
password is : conti



thats it guys...
send me your codes...
tnx... co coders


I'm really sorry but I truly doubt anyone here is going to do your homework for you, thats not what </dream.in.code>'s all about. This community is about helping fellow programmers with their difficulties, asking someone to create your application then give you the code doesn't fall into this category.


I agree if you would have asked instead of demanded you might have had a chance, I would start by reading some c++ tutorials, w3 schools is good, DIC has good tutorials too, (hint, use an if - else statment to compare, i would use a database to store the passwds in, so your people can add new passwds/change theirs later on in the software usage proccess, the client cant edit the code then compile again wink2.gif ) I realize its only school but good practice in school makes great development in life.
User is offlineProfile CardPM

Go to the top of the page

Bench
post 31 Aug, 2007 - 02:17 AM
Post #10


D.I.C Addict

Group Icon
Joined: 20 Aug, 2007
Posts: 602



Thanked 10 times

Dream Kudos: 150

Expert In: C/C++

My Contributions


QUOTE(arem026 @ 31 Aug, 2007 - 04:46 AM) *

we dont have a book in this subject he only discuss this like this by lecturedifficult nho?
You would still reap the benefits if you were to buy yourself a good book on C - There's only so much you can learn from reading internet tutorials
User is offlineProfile CardPM

Go to the top of the page

no2pencil
post 31 Aug, 2007 - 02:57 AM
Post #11


My fridge be runnin OH NOEZ!

Group Icon
Joined: 10 May, 2007
Posts: 6,354



Thanked 58 times

Dream Kudos: 2375

Expert In: Goofing Off

My Contributions


QUOTE(Bench @ 31 Aug, 2007 - 03:17 AM) *

QUOTE(arem026 @ 31 Aug, 2007 - 04:46 AM) *

we dont have a book in this subject he only discuss this like this by lecturedifficult nho?
You would still reap the benefits if you were to buy yourself a good book on C - There's only so much you can learn from reading internet tutorials

If I were looking into taking a course, giving a school my money in return for learning a skill, & they didn't offer books... wow. I think you are either not being honest with us, or you took a REALLY REALLY bad class.
User is offlineProfile CardPM

Go to the top of the page

ajwsurfer
post 31 Aug, 2007 - 06:15 AM
Post #12


D.I.C Regular

Group Icon
Joined: 24 Oct, 2006
Posts: 292



Thanked 2 times

Dream Kudos: 50
My Contributions


Please, lets not argue. Thank you arem026 for posting some code. The problem is that "strings", "cout", "cin" and "iostream" are not available in "C" you will probably want to use "character arrays". "stdio.h", "string.h", "printf()", "scanf()" and "strcmp()" to get the job done.

I see a lot of tutorials on the Internet, but please beware that you will need to do a lot of reading and practicing to get to the point where you can get this program done.

Here is a shortcut to getting this assignment done:
http://irc.essex.ac.uk/www.iota-six.co.uk/...f_and_scanf.asp

I would recommend sticking with the rest of the online book provided to get through the rest of the class, available at:
http://irc.essex.ac.uk/www.iota-six.co.uk/c/


Here is an excellent C/C++ programming reference:
http://www.cplusplus.com/reference/clibrary/
Just stick to the C library for C and the C++ library for C++.

wink2.gif

This post has been edited by ajwsurfer: 31 Aug, 2007 - 06:20 AM
User is offlineProfile CardPM

Go to the top of the page

2 Pages V  1 2 >
Reply to this topicStart new topic
Time is now: 11/23/08 06:03AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month