Learner010 99 Posting Whiz in Training

I'm back here after a very long period. And see lots of changes here. Beautiful and amazing design.
I was missing some illustrious members. here is who are they ? and why i still know them :

Reverend Jim provided full assistance while i was learning vb.net . i still remeber his great help in my first vb.net project (it was tic tac toe game). I learned lots of things from him. Sir , you're great.

deceptikon motivated me to write my first tutorial.He explained some of c++ concepts(operators and array).

mike_2000_17 is great person. He made concept of recursion very easy for me. To understand the concept i used to be in his shoutbox in late night. Hope he finished his PhD.

And, of course, dani for providing such a nice platform(daniweb.com).
looking forward to meeting similar kind of people in my journey of Android app Dev.

Now come to the topic.
I know c++ andvb.net. And little bit Java. Now i want to learn how to develop android apps. I'm totally new to this.
the only thing i know about Android dev. is that " i have to write code in Android studio" and i've downloaded it.

please suggest me some good websites/books where i can learn the basics of Android app dev. I'll start on my own and i'll be here with the code where i get stuck.

Thanks.

Learner010 99 Posting Whiz in Training

so what should i use instead of <conio> ??

I think nothing.Because in your code you use conio for just getch() function.I never realized the need of using conio and i think will never realize because i use standardize c++.And there is no need to use getch() for finishing a prgram by pressing any key.Its automatic (i don't know why ?).You can use code::block IDE which comes with GCC.

i think you are probably working with old aged compiler(like turbo)

my compiler doesnt show me void main() in error msg ..

But it should at least give a warning message.check it.

i write int main() then
should i write at the end of program return 0;?? .

yes, it will expect to return an integer value and this case and return 0 means your program executed without errors.

nd can u write an example program for me please ..

Sure ,here is the sample code :-

#include<iostream>
using namespace std;
int main()
{
cout<<"i'm back to daniweb.";
return 0;
}

hope this helps you.

ddanbe commented: Nice! +15
Learner010 99 Posting Whiz in Training

Did you by any chance happen to have discharged the battery completely while playing a heavy duty game? If so, I would bet your battery is toast. Reaching the minimum charge on a battery while drawing a lot of current from it can easily cause permanent damage to it, after which it can't be charged fully again.

Correct.
I think the battery has deep discharged.

Learner010 99 Posting Whiz in Training

without using while loop or user defined function?

with this line , your question becomes very easy.I'd say use library function.I think its str.length();

Learner010 99 Posting Whiz in Training

Well Done !
its now 1.11M Members.

Learner010 99 Posting Whiz in Training

If you handle each part as a separate problem you'll probably find you step through it pretty quickly.

correct.

your questions is not difficult. you can solve the homework by breaking it down into smaller parts. and these parts may be of:-

step 1. sort the digits (in ascending order)
step 2. sort the step1's answer in descending order
step 3. subtract step2-step1 and goto step1(with step3's answer).
it continues till you want.

ddanbe commented: Well said! +15
Learner010 99 Posting Whiz in Training

you can try this too :

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
//using std::cout;
//
//CLASS DECLARATION SECTION
//
class EmployeeClass {
public:
        void ImplementCalculations(string EmployeeName, int hours, double wage);
        void DisplayEmployInformation(void);

        string EmployeeName;
        int hours;
        double wage;
        float iTotal_salaries;
        int iTotal_hours;
        int iTotal_OvertimeHours;
        float basepay;
        int overtime_hours;
        float overtime_pay;
        float overtime_extra;
        float iIndividualSalary;
        friend void Addsomethingup(EmployeeClass, EmployeeClass, EmployeeClass);

};
EmployeeClass Employ1;
EmployeeClass Employ2;
EmployeeClass Employ3;


int main()
{

//    system("cls");
    // display welcome information
    cout << "\nWelcome to the Employee Pay Center\n\n";
    /*
    Use this section to define your objects.  You will have one object per employee.  You have only three employees.
    The format is your class name and your object name.
    */

    /*
    Here you will prompt for the first employee’s information.
    Prompt the employee name, hours worked, and the hourly wage.  For each piece of information, you will update the appropriate class member defined above.
    Example of Prompts
    Enter the employee name      =
    Enter the hours worked       =
    Enter his or her hourly wage =
    */
    // Enter employees information
    cout << "Enter the first employee's name      = ";
    cin >> Employ1.EmployeeName;
    cout << "\nEnter the hours worked               = ";
    cin >> Employ1.hours;
    cout << "\nEnter his or her hourly wage         = ";
    cin >> Employ1.wage;
    /*
    Here you will prompt for the second employee’s information.
    Prompt the employee name, hours worked, and the hourly wage.  For each piece of information, you will update the appropriate class member defined above.
    Enter the employee …
Learner010 99 Posting Whiz in Training

this is because your last iteration make ptrBr point to some unknown location(i.e point to 1 location back).
let's see how your iteration works

iteration no      ptrAr         ptrBr
iteration 1       a[1]           a[3]
iteration 2       a[2]           a[2]
iteration 3       a[3]           a[1]
iteration 4       a[4]           a[0]
iteration 5       some unkown address becuase in this case index can't be exceed to 4 and can't be less than 0. therefore i think both point to +1(for ptrAr) and -1 (for ptrBr)

therefore after the loop , add the following statement for desierd output

ptrBr++;
ptrAr--;
Learner010 99 Posting Whiz in Training

but i get the same memory address when i cout either fishp or &fishp.

Not possible.

if you use cout<<fishp then it print the address of the variable , it points to(therefore print the address of fish).

when you use cout<<&fishp then it print the address of the variable(fishp) itself.

therefore two differents addresses will be printed.

Learner010 99 Posting Whiz in Training

what you have done so far , to solve this assignment.
nobody will provide assistance until they realize that you did a lot with it.

don't forget to post your code here.

rubberman commented: Well put! :-) +12
Learner010 99 Posting Whiz in Training

problem display the unchange array

i don't see the code for displaying an array. you should use cout<< for displaying
i don't know what do you mean by the word unchange.

you should declare a pointer variable because i think you wanna play with dynamic array.so try this:

int* array;
cout<<"enter size";
cin>>size;
array=new int[size];

here is code for getting input:

for(i=0;i<size;i++)
{
    cin>>array[i];
}

and for displaying an array:

for(i=0;i<size;i++)
{
    cout<<array[i];
}

instead of code, you provide nothing.
please explain your question.

Ancient Dragon commented: right +14
Learner010 99 Posting Whiz in Training

your current form refers to as Me.
so , if you coding behind Form2 then you have to useMe.Textbox1.Text instead of Form2.Textbox1.Text.

but if you are working on Form1 and you wanna access textbox exist on Form2 then you have to use

Form2.Textbox1.Text

Learner010 99 Posting Whiz in Training

i use getline(cin,name);
but problem will still exist until you clear the buffer .

write this to clear the buffer :

cin.ignore(numeric_limits<streamsize>::max(), '\n');

don't forget to include <limits>.

please correct me if i'm wrong.

Learner010 99 Posting Whiz in Training

functions are very easy to learn (i recently learned it , except recursion, which today i'll finish).just read My Tutorial and read the section titled "Argument and return". if you read this tutorial carefully , you'll easily solve it.

try to do that with your own efforts , we'll provide assistance only and only if you face any problem(but this happens when you initiate to create it).

and don't forget to post your code in which you got error.

ddanbe commented: Good advise. +15
Learner010 99 Posting Whiz in Training

As usual, after learning new stuff, I write on it. Yesterday I finished learning on "Functions in C++" and found that functions are very easy to learn and useful. Hope this tutorial helps beginners.

What is function?

Sometimes when we want to execute a specific task wherever it's needed, instead of writing the entire code again, we should create a block of code that is called a function. Once you define the functionality inside the function body, you can call it whenever and wherever it's needed.
Functions prevent code repetition.

There are 2 terminologies:

  1. Defining a function: process of creating functionality
  2. Calling a function: process of executing functionality

Function is a subprogram / block of code which is responsible for a specific task.
We can divide functions in 2 major part:

  1. Library function
  2. User defined function (UDF, further in this tutorial, I’ll use this term instead of "user defined function")

In this tutorial, I'm not covering library functions. I don’t think that library functions require a tutorial, because library functions are readymade code, you need to add header files where these functions are defined and just call them. It's very easy.

Example: to calculate the length of a string, you need std::strlen() function and this is defined in cstring header file.

User defined functions are those function that user creates for a specific purpose.
For example, if you are creating an application which allows a user to issue maximum of 6 books, with 6 …

Learner010 99 Posting Whiz in Training

first off , i don't understand what do you mean by with calculation in c++

second , you can't get help by asking your question in such a manner. you have to write the entire question includes the problem definition , your efforts, comments and so on. Once you prove that you made efforts in order to solve the question and didn't succeed then i'm damn sure that daniweb will certainly help you and then nobody thinks that you are asking them to write code for you.

last , i can give you the hint:

"user inputs to array" does not uses any different mechanism , its done with as usual like cin>> and with other getting input functions.

use loop

for(i=0;i<10;i++)
{
cin>>arr[i];
}

the above code will help you to get input to array named arr.
See This Tutorial for more information on array.

Learner010 99 Posting Whiz in Training

hello

Learner010 99 Posting Whiz in Training

please show us your efforts to solve this problem . its almost impossible to get assistance if you don't prove what you have done.

for this code, you neeed nested looping and print statement of viualbasic and code will be written inside click event of the button.
if you are not familiar with nested looping then This Link will provide you an idea of how use it. Syntax may be different from language to language but logic remains same.
thats all about.

Learner010 99 Posting Whiz in Training

which one do you think is easier to read and understand ?

Obviously Loops.

i didn't meet with such a condition where goto is the only choice .i read about goto and find the following (its exactly what i thought):

Although the use of goto is almost always bad programming practice (surely you can find a better way of doing XYZ), there are times when it really isn't a bad choice. Some might even argue that, when it is useful, it's the best choice.

anyways, i'll create tutorial on conditional and unconditional statement in c++. There i'll try to explain my best.
Right Now , i am back to c++ and start learning where i stopped it and i'll write tutorial on strings(to just make you familiar with its library function),functions etc.And also will write tutorial on file manipulation when i finish learning it.
For Tutorial on pointers , i've already informed to deceptiokon.I am damn sure that he can write much better on it . I Can't Explain mcuh of it(I am not too good at Pointers, actually don't know every aspect of it).

So, if deceptikon is reading this post then please start writing on it so that no beginner will be scared of pointer anymore.Also your tutorial titled "Array in c++" was great.

Learner010 99 Posting Whiz in Training

what output you are getting ?

Learner010 99 Posting Whiz in Training

you can write an additional condition like this(inside while):

if(n1==n)
System.out.print(x);
else
System.out.print(x+" ");
Learner010 99 Posting Whiz in Training
import java.util.Scanner;
public class Pentagonal {
public static void main(String[] args) {
int n,x,n1;
Scanner input = new Scanner(System.in);
System.out.print("How Many Elements you want in the sequence ");
n = input.nextInt();
n1=1;
while (n1<=n) 
{
        x = (3*n1*n1 - n1)/2;
        System.out.print(x+" ");
        n1++;
}
}
}

Hope now you understand .

<M/> commented: OH! +10
Learner010 99 Posting Whiz in Training
while(num!=0)
{
count++;
//here again write code with to get input to `num` variable
}
System.out.print("Total Integer Numbers="+count);
Learner010 99 Posting Whiz in Training

Read the second line of my just above post. you have to get input into n variable and that's your limit of the pentagonal number sequences.

for example if give 5 to n then it will display first 5 pentagonal number

Learner010 99 Posting Whiz in Training

here i am telling the way what i used for it (you can also use predefined forms for this purpose).

just create two label and textboxes and one button .

on button you can now check for login as follow:

if(Txtusername.text="Admin" and Txtpassword.text="Password")
msgbox("login successful")
else
msgbox("Password Invalid")
End if

right now you should write above code but later (when you understand DB concept) then you can retrieve data from DB and then check for login.

hope this helps.

DM Galaxy commented: correct answer +2
Learner010 99 Posting Whiz in Training

try this:

int n,x,n1;
//here write code for getting input to n variable
n1=1;
while (n1<=n) 
{
        x = (3*n1*n1 - n1)/2;
        System.out.print(x+" ");
        n1++;
}

hope this helps

Learner010 99 Posting Whiz in Training

logic seems to be correct if you need the numbers in same line with tabs.use "\t" in print statement.if you need to print the number specific times then implement logic like this:

int count=1;
while(count<=n)
{
//your code
//your code
count++;
}

try this (for printing tabs):

System.out.print(n+"\t");

hope now you can adjust the code to your suitability.

Learner010 99 Posting Whiz in Training

I think that the earlier design was much better.
Anyways, this is also good design but i still say that the earlier was very much better.

That's my personal opinion.

Dani commented: What about it don't you like? :) +0
Learner010 99 Posting Whiz in Training

Hello and Welcome to Daniweb !

Learner010 99 Posting Whiz in Training

I agree with Reverend Sir, That if somebody set Be Invisible in their profile then it does not mean that the user can't be seen in the chat participant list.

. I think if someone has chosen to participate in a ShoutBox then the other participants have a right to know this

i agree.

I see no reason why the invisible status should apply to chat.

i agree.

one more reason:
let's suppose there are 2 users in the ShoutBox and one user has set the profile as Be Invisible.
How can other user get the idea whether another one is in chat or left the chat? other user thinks that the another one has set Be Invisible that's why i can't see his name and he continues to chat and post the shoutbox even though the other one already left the chat.

so its my suggestion that whether user are visilbe or invisible they should be shown in ShoutBox List.

hope dani will work on it.

Learner010 99 Posting Whiz in Training

i am learning arrays in c++. and i think if you try for it then you can do it very easily.

as a hint
you should start loop from 0 to 29 and add values like
sum+=array[index]

if you put your efforts here it will be very easier for us to identify where you are going wrong. So , don't forget to put here your code.

Learner010 99 Posting Whiz in Training

Yesterday i completed my exercises on loop , that's why today i've decided to create a tutorial on loop in c++.

Loop

loop allows us to repeat a statement or a group of statements. When we want to repeat a single statement then it is not necessary to put curly braces But if we want to repeat a group of statements then it must be enclosed with curly braces. And it is a good practise to enclosed your loop body with curly braces.

c++ has three loop control structures

while loop
do-while loop
for loop
while loop

Structure of while loop is as follow

while(condition)
{
statement;
statement;
statement;
}

while loop is entry controlled loop because it first check the condition And if result is found True then statements get executed.

let's see example

int a=1;
while(a<=10)
{
cout<<a++;
cout<<endl
}

Output:

1
2
3
4
5
6
7
8
9
10
do-while loop

do-while loop is exit controlled loop because condition is evaluated after each iteration.

i=0;
do
{
cout<<++i<<"\t";
}while(i<10);

Output:-

1   2   3   4   5   6   7   8   9   10

do-while loop will execute a statement or a group of statement for atleast one time even the condition is Zero(false).

let's see example

do
{
cout<<"Hello";
}while(0);

Output:

Hello
For Loop

Syntax of for loop(syntax may be different based on the requirement , here i put what is normally used):

kal_crazy commented: Very nice!! +2
Learner010 99 Posting Whiz in Training

but you can change the thread title?

Because he is one of the moderators.

Learner010 99 Posting Whiz in Training

there is no error and its working well.

when you run the program and it takes input and gives result and if console window close immediately , you can see console window (ways may be different from compiler to compiler).

or
in main()
you can add some function which are useful for getting input.
normally getch(); is placed at the last.

so use this

int main()
{
    int number ;
    printf("Enter a number to reverse: ");
    scanf("%d",&number);
    printf("\nReverse of entered number is = %d\n", result (number));
    getch();
}
Learner010 99 Posting Whiz in Training
Tutorial On Operators

Operators are the signs to the tell the compiler to perform specific task. The Operators fall into following categories :-

Arithmatic Operator
Relational Operator
Logical Operator
Bitwise Operator 
Miscellaneous Operator(i added Assignment Operators in this categeory) 

Arithmatic operators:-
There are following arithmetic operators:-

+       Add                     [6+2=8]
-       Subtract                [6-2=4]
*       Multiply                [6*2=12]
/       Divide                  [6/2=3]
%       Modulus(Reminder)       [7%2=1]

Relational Operator :-
Relational Operators are used to compare 2 values and result in true [1] or false [0].

<        less than
>       greater than
<=       less than equal to
>=      greater than equal to
==      equal to
!=      Not equal to

Lets take an example:-
A=5 and B=10

            CONDITION       RESULT
            A<B              TRUE
            A>B             FALSE
            A<=B         TRUE
            A>=B            FALSE
            A==B            FALSE
            A!=B            TRUE

Logical Operators:-

Logical operator are used to combine more than one expression .

&&      =       LOGICAL AND
||      =       LOGICAL OR
!       =       LOGICAL NOT

&& and || are binary operator whereas ! is unary operator. && and || are called binary because both work on 2 operand where ! works on single operand
&& Operator Produce 1[true] if the all expressions are true. And it produce 0[false] if any one expression is false. let’s see it truth table .

EXP1        EXP2        RESULT      
TRUE        TRUE        TRUE        
TRUE        FALSE       FALSE       
FALSE       TRUE        FALSE           
FALSE       FALSE       FALSE   

Lets see the example below(a=10,b=20,c=30)

Expression               Expression evaluation      Result 
a<b      &&     a<c           true    && …
ddanbe commented: Nice! +14