0

lol thnx its working now but like this
while (strcspn(Book.name,"qwertyuiopasdfghjklzxcvbnm1234567890") != NULL || ( strlen(Book.name) < 4 ))


hahahaha now
can u tell me is it possible to calculate the number of books in the librery by suming up all the copies ?
i tried to put
int sum;
int total; ( both of them not in struct)
and open a new case
total = sum(Book.copies) but it wont work :S

0

CLS and cls are not distinguished in C and secondly your code is error free.You do need to modify the strings section a bit.

Glad you joined in this thread, but next time please take the time to read the whole thread so that you don't look like such a fool.

0

hahahaha now
can u tell me is it possible to calculate the number of books in the librery by suming up all the copies ?
i tried to put
int sum;
int total; ( both of them not in struct)
and open a new case
total = sum(Book.copies) but it wont work :S

It didn't work because sum is not a function. And such a function doesn't exist in either c or c++ languages. Maybe you have it confused with the sum function in SQL. The way to do it is to loop through all the books and total up the copies, very much the same way you would do it manually.

0

CLS and cls are not distinguished in C and secondly your code is error free.You do need to modify the strings section a bit.


Online business administration

umm steve what are u talking about i mean which code . cause there i got 2 types of struct now.

and
thank you for answering i also know my program donot have problem but that is something my lecturer wont agree with me. also he needs more functions and i cannot tell him anything because i really have a low course work . so am working my as better as possible to get a 100% mark on this .
now then while u did have time to reply . i need 2 more things .
1. i need to hide my password to *** . i mean when i type it should view ****.
2. i need to sum up the total records which will be viewed in another selection.( i mean i need to sum up added Book.copies ) ( also its freaking me out because i do not know how to even call it )

0

i have a idea now
what if i call back the display part again and just show the copies there. can work a bit . but now i cannot relate each records with other how to get that working ? i mean how to get loop work among all the records i added.

i would be real happy if there is a code that can sum up the amounts in screen :D

0

>> i also know my program donot have problem but that is something my lecturer wont agree with me. also he needs more functions

That is what I was trying to tell you in the very beginning of this thread. You have written the entire program in main(). You need to split it up so that there are several functions.

0

noooooooooooooooo i donot mean that kind of functions :S
1.he need now a entire new password system ( i wont make it )or the password to view as *** ( am trying to get this working thnx to you i didnt need to go throught everything and fix the problems u fixed for me )
2. he needs me to get the total number of book.
( am pretty sure that when i get total number of book in the library he will as me to do the total price thing) ( even if its on the day of my viva which is this monday)
thank you again :D

0

i seem not to get anywhere with this new password code . i donot know what is the problem( but i think am mistaking the password part ) hope :D i can get help for this .
thank you in advance again.

0

i saw that post but i problem here is i have a preset password. and i am unable to get the preset password work with the codes of hiding passwords . i can get *** when i input but i cannot get it matched with my password .
like this

char Text[255];
memset(Text, 0, 255);
for(int i=0; i<254; ++i)
{
char c;
c=getch();
if(c==13)
{
break;
}  else
{
Text=c;
cout<<"*";
}
}

it gives me the output of *** but i cannot connect it to my password ( 123)

Edited by Nick Evan: Fixed formatting

0

yeah i know its enlightening but i have a viva tommrow and i still cannot connect my pass with the code . can any one please help me connecting them :S

0

now this code i got . this one can show *** but i cannot relate my password with the *** going in. so can any one tell me how can i get my password there.
i mean the text should go as my password but it don goes like that

Attachments
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <conio.h>
#include <fstream>
#include <string>
#include <ctime>
#include <sys/stat.h>
#include <windows.h>

using namespace std;



int main ()
{
	int Auto;
	ifstream input;
	input.open("id.txt"),ios::in;
	input >> Auto;
	ofstream output;
	int tries = 3;
	string acc,password,MainPage;

	cout << "\n\n\n";
	cout << "\t\t***************************************************" <<endl;
	cout << "\t\t***************************************************" <<endl;
	cout << "\t\t***                                             ***" <<endl;
	cout << "\t\t***                  Welcome                    ***" <<endl;
	cout << "\t\t***                    To                       ***" <<endl;
	cout << "\t\t***          Library Book Registration          ***" <<endl;
	cout << "\t\t***                  Program                    ***" <<endl;
	cout << "\t\t***                                             ***" <<endl;
	cout << "\t\t***************************************************" <<endl;
	cout << "\t\t***************************************************" <<endl;
	cout << "\n\n\n";
	
	{

	while (tries)
	{
	cout <<"Please Enter ID: \a";
	cin >> acc;
	cout <<"Please Enter Password: ";

char Text[255];
memset(Text, 0, 255);
for(int i=0; i<254; ++i)
{
     char c;
     c=getch();
     if(c==13)
     {
          break;
     }  else
     {
           Text[i]=c;
           cout<<"*";
           
      }
}
	
	if (acc == "abc" && password == "123" )
	{
		cout << "endl " << endl;
	}
	else 
	{
		cout << "Invalid Id or Password. Please enter again" <<endl;
		cout << "The Program Will terminate After ("<<tries<<") Unsuccessful Try" <<endl;
		tries--;
	}
	}
	
	return -1;
}
	
	
	
	
	return 0;
}
0

i just wanted to post this because am writing this same thing in my assignment as acknowledgement

This assignment was something that seemed too hard at the beginning. But I would really like to give thanks to my lecturer for being harsh, what in the end made my do my work as good as I can do. I also like to give thanks to my class mates for helping me with the work. But among all the people I am most great full to Ancient Dragon ( I don’t know his real name ), who helped me through all my toughest parts.

0

how are you trying to compare the contents of variable Text to 123? Is 123 an integer or character array "123"? If its an integer then you will have to convert Text to integer. if( atoi(Text) == 123)

0

"123" ... is under a string password.

char Text[255];
memset(Text, 0, 255);
if( atoi(Text) == 123)
for(int i=0; i<254; ++i)

now where can i put that password string . i donot want text there and the int calculations :S i want it plain :S

0

Reading your original program again you don't need to use atoi. You have to call strcmp() to compare them.

if (strcmp(acc,"abc") == 0 && strcmp(password,"123") == 0 )
	{
		cout << "endl " << endl;
	}
0

can i please ask the full code from u please . because i have only 5h left :S .... and its 3 am at morning i wana go sleep a bit :S

0

thank you all for helping me out with this . i submitted it .

but i still want to continue adding features in it .like
how many books in the library. and print out the books information. so if u know which function i can use for them please let me know

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.