Can you atleast show some code mate.?
We dont do homework here. We assist with homework.
richieking 44 Master Poster
Can you atleast show some code mate.?
We dont do homework here. We assist with homework.
So maybe post your code and we can start from there.
Also without any experience in signals and slots, You do not have any chance in GUI. Thats the whole point of GUI.
yes I got it...I did a basis mistake...I should include the header files in the begining.
The basic logic is yes.
You can also try this.
This is according to your post
hello i'm trying to figure out how to write a program in c++ that check when i insert a password and force me to add at least 2 capital letters and 2 numbers in the password (you've seen this before right? when signing up for new account and checks for password stringth)
Below is a simple code to mimic such thing.
bool chkUperDegitPwd( const std::string pwd){
static size_t sCount=0; // static count
for(auto &p: pwd){ // >= c++11
if(std::isdigit(p)){
sCount++;
}else if(std::isalpha(p)){
if(std::isupper(p)){
sCount++;
}
}
}
return pwd.length() == sCount ?true:false;
}
// use case
std::string pwd;
std::getline(std::cin,pwd);
if(chkUperDegitPwd(pwd)){
//do your stuff
}else{
// password error
}
This is not automatic but easily doable.
You now have the filtered records,
You need to get all the filtered records by id,
Use the id to change/update all the filtered records
You may wanna change your class name to say txt or whatever.
Array is a C++ lib. MosChops just warned you aboout that.
Now add change to say class txt and add this code.
enum {MAX_INT=5};// global enum
bool operator ==(txt a){
return a.getSize() == getSize();
}
const int getSize(void)const{
int sum = 0;
for (int x=0; x < MAX_INT; x++) {
sum += arr[x];
}
return sum;
}
I want you to figure things out yourself.
Why String^ to just a string?? change that.
And what do you mean by manually?
Please explain....
I think its better to use sort() from the algorithm lib.
C++11 has make the language more rubost and powerful.
I advice all the newbies to have a better grisp of the algorithm lib.
Most of your woes you are facing are all done. Algorithm lib must be your household name.
Check your logic up.
Use this to get the idea...
#include <iostream>
using namespace std;
int main()
{
bool ff = true;
short tt;
short count=1;
while(ff){
for(tt = 0 ; tt < count ; tt++){
std::cout <<"*";
}
count +=5;
std::cout<<endl;
if(tt >= 50){
ff= false;
}
}
return 0;
}
Can you paste some results you get after running your code here.
I think you are talking about how to format the data for use.
I stand to be corrected anyway.
In your int main function you must return a value.
int main always must return a value.
use this
#include <iostream>
using namespace std;
int main()
{
int foo []={4555,1,56,2,7,4,5,60,7,8,9,90,8,12};
int temp;
for(int i =0; i< sizeof(foo)/sizeof(int); i++ ){
for(int c =0; c< sizeof(foo)/sizeof(int); c++ ){
if(foo[c] > foo[i+1]){
temp = foo[c];
foo[c]=foo[i+1];
foo[i+1]=temp;
}
}
}
std::cout <<"\n"<<"\n";
for(int &d : foo){
std::cout <<d <<std::endl;
}
return 0;
}
Your code please.
First of all your your design or approach to your idea is wrong.
you must understand or read more about templates. Every template must be initialized with a data type.
1.Example: in the main I don't see that. Eg. Node<?> *foo. Etc.
2. Your there is no data in your
container to manipulate. You must put data first because how do you want to printque if it's empty.??
Form HTC 816.
So what is your problem now??
Do you have any issues??
I have checked with your idea on your google code hosting page. I think its very interesting concept.
I have downloaded your demo and source code to play with it.I will get back to you ASAP.
And can you show your code please?
ok i will be very brief with my answer.
Your question:
since "state" is a pointer, why doesn't -> work? ptr[i] -> state = num; // doesn't work. why?
Yes it will work only if you understand how pointers work.
1. when you operate on pointers like *ptr[i].state=num;
you loose the pointer in the way pointer is been called. you subscript or dive into the container. Something like a manual operation.
You can code like ptr->state = #
to put the address of num into the state pointer how ever your intensions are different.
You are mixing apples and oranges. You need to understand both skills.
Also understand the differences between the 2 datatype.int *state
is an int pointer which its used commonly in 3 different ways due to safety but other people may diffe as this is entirely my point of view.
1. state = new int;
2. state = #
3 state = num;
where num is an int pointer.
Your last question:
// cout << ptr[i] -> state; // doesn't work. why?
Because ptr has lost the pointerness. You have traded off its power as a pointer to a mere array. Arrays and pointer shares some similarities and this operation is one of them. Its called indexing.
You could writecout << ptr->state;
but that will cause 3 errors according to what you wanna achieve.
1. You will recive the address of …
There are 2 things to do according to what you wanna achieve.
1.Bring double ranum = rand()%11;
line 7 on the first line in the void loop function.
or2. make double ranum = rand()%11;
a global declaration as you have been advised.
Also i just wanna know how your programme is organized.. that is in a class or just procedual function method.
We help with your homework but not doing them.
please show some effort first.
You can not simply connect to your database on another system like that.
There must be a contact or a server on the remote system that you will use to open the way to the inner operation.
This is simply done by running a server on the remote system that will connect to your app and via the connection have access to the DB.
Look into sockets and clients howtos.
So in short, there must be a server and a client.
Besides this there is no way to just connect to remote DB like what you want. Well i stand to be corrected but i am pretty confident with my answer as i have done this numerous times.
samsondadson3
on line 18 the return statement must not be inside that bracket.
Return must be inside the main's as it is returning int main()
fuction.
That is the power of precedence.
The multiplication will take the power. thats int y =a-b++ * --b;
you need to put them in a correct arragement depending on what you want to achieve such as.
1. int y = (a - b++)*--b;
2. int y = a-(b++ * --b);
Any selection above will at least provide you with a constant answer because the compiler will explicitly understand your intention.
Are you talking about this?
Well show some code next time. We are here to help not to do your homework.
float recSq(float x, float y){
return x*y;
}
Imagine you are developing a software package that requires users to enter their own passwords.
Your software requires that user’s passwords meet the following criteria:
• The password should be at least six characters long.
• The password should contain at least one uppercase and at least one lowercase letter.
• The password should have at least one digit.
Write a program that asks for a password and then verifies that it meets the stated criteria.If it doesn’t, the program should display a message telling the user why.
Do we look that stupid for you yea? Be a man and ask for a help. Dont try to disrespect us ok? We are way ahead of you in smartness.
Master when do you need your programme? How soon? Anything again master?
And you expect us to do that for you dont you master?
Sure we will.. just give us one more month please master.
try and learn cpp very well and try not to rush your way through. take your time to understand well the language and other goodies will follow.
void Database::getPNResults(bool* bErrors)
can you show how you called this fuction in your code?
Also understand the basic use of a pointer.
Pointers on creation are initialized to point to a specific memmory or points to a 0/NULL.
I stand to be corrected but If you dont follow this basic rules, you will fall into a segfault/null pointer errors just like what you have now.
Can you show us your code ... Show us something.
Shall we share some ideas??
We dont do no homework here.
Help yourself service only.
Show some code first..
Provide some code and we will work from there.
AD... That is not true.
"Now, you tell us which is more eligent -- pretty code that crashes often, or not-so-pretty code that runs without problems?"
All basic loop or recurssion can crash. The main problem is the algorithm in place and the amount of memmory to use so the concept of crashing an application due too memory is very trival.
What i am demandeing is the over all effectiveness and readability of the 2 codes. Like i said and i will repeat that again. There are situations recursion is the right way to go.
Your point here Mr AD is not good from a pro. Pretty and elegant codes are well contained and maintained, easy to debug than a worm code. Wriiting a wornm code is more dangerous.
can you post your code here if you dont mind.?
we need to read through your code.... possibly run it ourselves ok
So my question to
is that what makes you think that your code is better than
recurssion??
Like i pointed to you recurssion is more elegant,simple but effective to read. the concept and use of recurssion can be a personal choice but i think you when a bit far with your previous comment about recurssion.
If you can show us some code about your quest, maybe we may help you achieve your goal.
So show us your code so far.
You need to post your error and the line that the error points to.
You have different headers
that we dont have access to test your code.
What error?? take your time and explain your problem very well. We need to understand what you want to achieve before we can assist you.
Mike_2000_17 What are you saying??
That recursion should not be practise or are you saying recursion is worse than other loops? Are you serious? Do you want to see a bench mark? I cant get you.
Please explain yourself because i have seen how you have dismantled my comments without any bench mark. We cant give wrong idea like that wihtout any tangeble proofs. Like i said there are not much difference between recursion method and other loops and in some cases its the best way to go. So what is than you disagrees with.?
The way you have commented seems a bit strange as a pro. You may not like recursion but the power and its elegance can not be disputed.
I prefer bench amrk from you before smashing recursion like that because i have well accepted benchmarks to proof your assertions wrong.
Are you that lazy even to google around?
What sort of laziness is that? What you need is everywhere on google.
If you cant help yourself... then do not expect any help from anyone here.
Deleting data in vector comes with a lot of work. For your operation, you need to consider list.
Now based on your code , from line 49
to end. i dont personally like how you are dealing with the vector. vector comes with iterator to use to loop through your vector.
on line 60
your if statement must look like thisif(userDetails[i].getUserName()==name){
userDetails.erase(userdetails[i]) ;
userDetails.resize();
}
Vectors limitation is this form or operations so next time plan your tasks very well and think about which libs to use.
on line 6
you have char *prog_arv[4];
this is like char **prog_arv
.
you need to remove * to have char prog_arv[4];
for the way you intend to use the char array.