פורסם 2005 באוגוסט 1220 שנים עשיתי איזה תוכנה ויש לי בעיה קטנההתוצאה שהתוכנה מציגה לי הוא בצורה הבאה 9.25596e+08למה זה??איך אני פותר את זההמשתנה שמאכסן את המספר הזה מוגדר כ FLOATבבקשה תעזרו לי אני צריך להגיש את זה להיוםתודה לעוזרים
פורסם 2005 באוגוסט 1220 שנים גם זה מספר...בכל מקרה, תכתוב כאן את הקוד של התוכניות ונוכל לעזור לך בצורה טובה יותרומה פתאום אתה צריך להגיש היום משהו?! :s05:
פורסם 2005 באוגוסט 1220 שנים מחבר אני לא לומד בארץיש לקוד איזה אלף ומשהו שורותאבל נגיד שזה ככה (רק הרבה יותר מסובך)float d,a,b,cd=a+b+ccout << d
פורסם 2005 באוגוסט 1220 שנים עם החלק הזה אני לא ממש רואה בעיה כלשהי (חוץ מהעובדה שלא כתבת ";", אבל לא נהיה קטנוניים ) תצטרך לכתוב יותר בפירוט איך הצבת את המספרים בשאר המשתנים?
פורסם 2005 באוגוסט 1220 שנים מחבר אוקי זה נורא קשה להעתיק רק חלק מסויםוזה גם בספרדית (מה שלא קוד)אבל אני ינסה הנה חלק מהתוכנהלמשתנה הבעייתי קוראים snetoוכמו שאתה רואה בשורה המודגשת באדום המשתנה הזה שווה לסכום של כמה משתנים נוספים שכולם מוגדרים תחת אותו סוגFLOAT#include <iostream>#include<fstream.h>using std::endl;void main (void){ int opcion,ht,seguir=1; float pago,salario,ssocial,seduc,IR,dduc,sneto; char nombre[20],ced[15],apellido[20], menu='m',deduc='n', data[300]; ofstream fout; ifstream fin; while (menu=='m') { system("CLS"); cout<<"\t\t\t PLANILLA\n\n\n\n" <<"\t\t\t\t\t\thecho por TAL LEVY\n" <<"\t\t\t\t\t\tCED:E-8-89925\n\n\n\n\n" <<"1.Crear una nueva planilla y introducir el primer registro\n" <<"2.Ver registros de la planilla existente\n" <<"3.introducir nuevo registro a una planilla existente\n" <<"4.Salir del programa\n\n\n" <<"Escoge Una Opcion: "; cin>>opcion; switch(opcion) { case 1: fout.open("planilla.txt", ios :: out | ios :: trunc); seguir=1; while (seguir==1) { system("CLS"); cout<<"\t\t\tREGISTROS DE PLANILLA\n\n\n\n"; fout <<"\nRegistro"<<endl; cout<<"\nNombre-> "; cin>>nombre; cout<<"\nApellido-> "; cin>>apellido; fout <<"\nNombre Completo: "<<nombre<<" "<<apellido<<endl<<"\n"; cout<<"\nCedula-> "; cin>>ced; fout <<"Cedula: "<<ced<<endl<<"\n"; cout<<"\nHoras Trabajadas-> "; cin>>ht; cout<<"\nPago basico por Hora-> "; cin>>pago; if (ht<=40) salario=ht*pago; else if (ht>40 && ht<=50) salario=40*pago +(ht-40)*(pago*1.10); else salario=40*pago + 10*(pago*1.10)+ (ht-50)*(pago*1.15); cout<<"\nEl salario bruto de "<< nombre<<" "<<apellido<<" es de "<< salario ; //Deducciones ssocial=salario*0.0725; seduc=salario*0.0125; if (salario<800) IR=0; else if (salario>800) IR=salario*0.15; else if (salario>1000) IR=salario*0.16; else if (salario>1200) IR=salario*0.17; else if (salario>1300) IR=salario*0.18; else if (salario>1500) IR=salario*0.20; cout<<"\n\n Algunas deducciones externas? s/n: "; cin>>deduc; if (deduc=='s') { do { cout<<"\nIntroduzca la deduccion = "; cin>>dduc; cout<<"\n Algunas deducciones externas? s/n: "; cin>>deduc; } while (deduc=='s'); } sneto=salario-(ssocial+seduc+IR+dduc); cout<<"\nSeguro Social= "<<ssocial; cout<<"\nSeguro Educativo= "<<seduc; cout<<"\nImpuesto Sobre la Renta= "<<IR; cout<<"\nEl salario neto de "<< nombre<<" "<<apellido<<" es "<< sneto ; fout <<"Salario Neto: "<<sneto<<endl<<"\n"; fout <<"- - - - - - - - - - - - - -\n"<<endl; cout<<"\n\nDesea Continuar? Marque 1 para seguir, 0 para el menu principal: "; cin>>seguir; } fout.close(); break; case 2: seguir=1; while (seguir==1) { system("CLS"); cout<<"\t\t\tPLANILLA\n\n\n\n"; fin.open("planilla.txt", ios :: in); fin.getline(data,300); while (!fin.eof( )) { cout<<data<<"\n"<<endl; fin.getline(data,300); } fin.close( ); cout<<"\n\nMarque 0 para el menu principal: "; cin>>seguir; } break; case 3: fout.open("planilla.txt", ios :: out | ios :: app); seguir=1; while (seguir==1) { system("CLS"); cout<<"\t\t\tNUEVO ANEXO\n\n\n\n"; fout <<"\nRegistro "<<endl; cout<<"\nNombre: "; cin>>nombre; cout<<"\nApellido: "; cin>>apellido; fout <<"\nNombre Completo: "<<nombre<<" "<<apellido<<endl<<"\n"; cout<<"\nCedula: "; cin>>ced; fout <<"Cedula: "<<ced<<endl<<"\n"; cout<<"\nHoras Trabajadas: "; cin>>ht; cout<<"\nPago x Hora: "; cin>>pago; if (ht<=40) salario=ht*pago; else if (ht>40 && ht<=50) salario=40*pago +(ht-40)*(pago*1.10); else salario=40*pago + 10*(pago*1.10)+ (ht-50)*(pago*1.15); cout<<"\nEl salario bruto de "<< nombre<<" "<<apellido<<" es "<< salario ; //Deducciones ssocial=salario*0.0725; seduc=salario*0.0125; if (salario<800) IR=0; else if (salario>800) IR=salario*0.15; else if (salario>1000) IR=salario*0.16; else if (salario>1200) IR=salario*0.17; else if (salario>1300) IR=salario*0.18; else if (salario>1500) IR=salario*0.20; cout<<"\n\nTiene algunas deducciones extras? s/n: "; cin>>deduc; if (deduc=='s') { do { cout<<"\nIntroduzca la deduccion por favor = "; cin>>dduc; cout<<"\nTiene algunas deducciones extras? s/n: "; cin>>deduc; } while (deduc=='s'); } sneto=salario-(ssocial+seduc+IR+dduc); cout<<"\nSeguro Social= "<<ssocial; cout<<"\nSeguro Educativo= "<<seduc; cout<<"\nImpuesto Sobre la Renta= "<<IR; cout<<"\nEl salario neto de "<< nombre<<" "<<apellido<<" es "<< sneto ; fout <<"Salario Neto: "<<sneto<<endl<<"\n"; fout <<"- - - - - - - - - - - - - -\n"<<endl; cout<<"\n\nDesea Continuar? Marque 1 para seguir, 0 para el menu principal: "; cin>>seguir; } fout.close(); break; case 4: return; break; } }}
פורסם 2005 באוגוסט 1220 שנים אתה צריך להשתמש בספריה בשם iomanip.קישור לדף הסבר חביב.קישור לקוד דוגמאבהצלחה!Off Topic - מה זה שם? ספרדית?
פורסם 2005 באוגוסט 1220 שנים מחבר כן זה ספרדיתוזה לא עבד ליהוספתי את הספריה הזאתוה SETW לא עזרהוספתי את ה SETW בשורות הכתומותולא קרה כלוםאני חושב שזה לא קשור בצורה שהוא מציג אותו כי התוצאה שהוא מציג בכלל לא קשורה לתוצאה שאמורה לצאת
פורסם 2005 באוגוסט 1220 שנים תהנהhttp://www.google.com/search?q=cout.+float+accuracy&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official
פורסם 2005 באוגוסט 1320 שנים מחבר תודה רבה לכל העוזרים מצאתי כבר את הפתרון זה היה איזה משתנה מזורגג שהיה חסר בקיצור הגשתי את הפרויקט היום והפרופסור אהב את זה :jump: שוב תתודה רבה לכולםםם
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.