robinhood
08-10-2006, 12:29 AM
I'm a new member with u guys
sorry i write in english
Im studying programing in the frist semester and i have my frist assignment its make a program using++ C
bt i dont know how 2 start
its like this................
there is company they has a new collective agreement 4 the workers have won a seven point six percent.............. payroll increase ,effective 6 months now to assist payroll in computing the new aslary and retoactive pay i have 2 count the new salary with the old salary(10000) also
the usualy salary is 100000
i will return annual salary,monthly salary, and retroactive pay
new annual salary 107600
new monthly salary 8966 point67
retoactive salary due 3800
Frist i dont know how 2 make the problem definition
algorithem design
I really need help in the begining so if any one have time 2 help me thansk 4 him or her
منطلق بطموحي
08-10-2006, 03:16 PM
السلام عليكم
Welcome to the forum...hope ypu enjloy ur stay woth us halatkn
i will writ some hints in the next reply
منطلق بطموحي
08-10-2006, 03:39 PM
in programming we have to calrify the things before solving in an algorithmic way
to do so , we have to know some mathematical background ( not always but in the case of our problem)
assume the salary is 100,000 as you said
to gut the bons 7.6% we have to multiply 100,000 by 0.076 and then add up the salary 100,000 to it
Now we need accurate numbers , hence type float or double will be used rather than int
assume the salary to be float s;
the new generated salary float ns;
then ,
we ask the user for the salary
cin>>S;
then
ns=(0.076*s)+s
then we can output it
cout<<ns;
same way you can generate the monthly salary by dividing ns by 12
In an algorithmic way :
1.Ask the user for the salary
2.Generate the salary due to the formula
3.print the new salary
You can use many techniques such as control structures , etc... you will study things while moving further...
If you face any problem dont hesitate to ask
wafk
robinhood
08-10-2006, 06:33 PM
thank u so much i will try 2 do it ...............thanks alot
منطلق بطموحي
08-10-2006, 07:51 PM
ur welcome...tell me if u face any problem during programming
wafk
robinhood
10-10-2006, 12:38 AM
السلام عليكم ورحمه الله
شكرا مجددا لمساعدتي علي عمل برنامجي الاول
لقداستفدت كثيرا من ما علمتني في المره السابقه لكن خلال البرمجه واجهت بعض المشكلات هلا وضحتها لي من فضلك؟
1_عندما اسمي المجاهيل(S)كيف اترجم للبرنامج ان (S)تعني
salary
2_لقد حاولت مرارا ولكن في كل مره تضهر لي (errors 6)
ساضع محاولتي هنا هلا تفضل احد الاساتذه بالاجابه علي؟؟؟؟؟؟؟؟؟؟؟؟؟ ملاحظه لم تكن برمجتي بهذا السوء(اعني بعكسالاتجاه ولكن لم استطيع تعديلها )
#include <iostream.h>
double
main ()
**
total_salary=salary*new_salary;
cout<<"please enter your salary\n";
cin>>salary=s;
cin>>((0.076*'s')+'s')='ns';
cin>>ns;
cout<<"this is your new salary\n";
return 0;
}
COMPILING...
ASSIGNMENT_1.CPP
C:\DOCUMENTS AND SETTINGS\ALOLA\DESKTOP\ASSIGNMENT_1.CPP(6) : ERROR C2065: 'TOTAL_SALARY' : UNDECLARED IDENTIFIER
C:\DOCUMENTS AND SETTINGS\ALOLA\DESKTOP\ASSIGNMENT_1.CPP(6) : ERROR C2065: 'SALARY' : UNDECLARED IDENTIFIER
C:\DOCUMENTS AND SETTINGS\ALOLA\DESKTOP\ASSIGNMENT_1.CPP(6) : ERROR C2065: 'NEW_SALARY' : UNDECLARED IDENTIFIER
C:\DOCUMENTS AND SETTINGS\ALOLA\DESKTOP\ASSIGNMENT_1.CPP(11) : ERROR C2065: 'S' : UNDECLARED IDENTIFIER
C:\DOCUMENTS AND SETTINGS\ALOLA\DESKTOP\ASSIGNMENT_1.CPP(13) : ERROR C2679: BINARY '>>' : NO OPERATOR DEFINED WHICH TAKES A RIGHT-HAND OPERAND OF TYPE 'CONST DOUBLE' (OR THERE IS NO ACCEPTABLE CONVERSION)
C:\DOCUMENTS AND SETTINGS\ALOLA\DESKTOP\ASSIGNMENT_1.CPP(15) : ERROR C2065: 'NS' : UNDECLARED IDENTIFIER
ERROR EXECUTING CL.EXE.
ASSIGNMENT_1.EXE - 6 ERROR(S), 0 WARNING(S)
منطلق بطموحي
10-10-2006, 01:27 PM
السلام عليكم:
محاولة جيدة كبدايه ...
ساضع تصحيح و لدي بعض التعليقات
#include <iostream.h>
double main()
**
double salary , new_salary , month;
cout<<"please enter your salary\n";
cin>>salary;
//total_salary=salary*new_salary;
new_salary=((0.076*salary)+salary);
month=new_salary/12;
cout<<"this is your new salary: "<<new_salary<<endl;
cout<<"The monthly amount = : "<<month<<endl;
return 0;
}
لاحظ هذا السطر:
double salary , new_salary , month;
هذه اجابتي على سؤالك كيف يفهم البرنامج ان هناك شيء اسمه salary اما استعمالك ل s دون التعريف باول البرنامج فالمترجم لن يفهم شيء منك
هذه الجملة توضح طريقة صياغة المعادلات :
new_salary=((0.076*salary)+salary);
لكن كتابتها بهذا الشكل:
cin>>((0.076*'s')+'s')='ns';
فانها تعني اني ساتوقع ان يدخل المستخدم معادلة و هذا خطأ ....انت فقط تدخل القيم مثلا cin>>salary و تقول cout <<new_salary مثلا فهو سيعوض بالمعادلة تلقائيا ليخبرك بالنتيجة
شيء اخر الاستخدام 's' تعني انه حرف و ليس رقم و هذا غير صحيح...
cout<<"this is your new salary\n";
هنا سيطبع الجملة فقط يجب ان تكملها ب <<newsalary;
اممم بقي عليك ان تكمل بقية المطاليب بالسؤال و ينتهي البرنامج
wafk
robinhood
13-10-2006, 03:06 PM
thank u soooooooooooooooooooooooooo much u help me alot
منطلق بطموحي
14-10-2006, 09:19 PM
You are welcome my brother
Don't hesitate to ask me any question whenever you need a help
wafk