Hello Thomas.
28 Jan 98 08:02, Thomas Maeder wrote to Cyber Con:
CC>> input "Enter Name " , name$ 'Note this is Qbasic code and i see it
CC>> c++
CC>> if name$ = "Cyber Con" then print "Hi Cyber Con"
CC>> open "file1.fil" as 1
CC>> put 1, name$
CC>> Close
CC>> END
TM> #include
TM> #include
This code is about as likely to work as his pseudo code.
TM> int main(int, char **)
TM> {
TM> cout << "Enter Name ";
TM> string name;
TM> cin >> name;
TM> if (name=="Cyber Con")
That doesn't work. You're comparing addresses. Use strcmp.
TM> cout >> "Hi Cyber Con";
TM> ofstream("file1.fil") << name;
You have to open the file before you can write to it.
TM> }
And close it when you're done
CC>> //' next program
CC>> open "file1.fil" as 1
CC>> get 1, name$
CC>> print name$
CC>> END
TM> #include
TM> #include
TM> int main(int, char **)
TM> {
TM> string name;
Same as above applies here.
TM> ifstream("file1.fil") >> name;
TM> cout << name;
TM> }
-Roger
... A program is used to turn data into error messages
--- Msged 4.20 beta 3
(1:273/404@fidonet)
---------------
* Origin: Hodge-Podge Support BBS, Upper Darby, Pennsylvania, USA
|