Sorry for being so late at creating this class blog. If you have any problems with code or anything here is the place to talk about it during the week. All the best.
No sir, i didn't copy it for the message, it was in the program:-) i used this online compiler http://cmpe150-1.cmpe.boun.edu.tr/phpccompiler/login.php
Natalie try running your program from the command prompt. If you don't know how i will guide u through.I tried this in my compiler and didn't work but got the result in the command prompt.
#include stdio.h
main(){ int a,b; printf("enter first number:"); scanf("%d",&a); printf("enter second number:"); scanf("%d", &b); printf("%d + %d = %d\n",a,b,a+b); getchar(); }
Sir i am using dev-c++ and its working but not what i did in class.. example #include int main () { using namespace std; cout << "Hey stephan."; cout << endl; cout << "Dont slap shannon!" <<endl; system ("pause"); return 0; }
Hey, i need help trying to make a program to solve quadratic equations, how would i enter the square reet part?
// // This program finds the x cordinates of a quadratic equation #include main(){ float a,b,c,TOTAL1,TOTAL2,x1,x2; printf("WELCOME TO QUADRATIC CALCULATOR:-)"); printf("\nPlease enter the value of a\n"); scanf("%f",&a); printf("\nPlease enter the value of b\n"); scanf("%f",&b); printf("\nPlease enter the value of c\n"); scanf("%f",&c); TOTAL1= b*b-4*a*c; printf("\nTOTAL1 IS %f\n",TOTAL1); TOTAL2= TOTAL1*.5; x1=(-b+TOTAL1)/2*a; x2=(-b-TOTAL2)/2*a; printf("\nYour answer is x1=%f\n",x1); printf("\nYour answer is x2=%f\n",x2); }
Randy neither msn or yahoo allowing me to send the compiler cuz of its extension (exe.)......if u have any ideas on how to bypass this feel free to share......otherwise will bring on sunday.
The mid-term examination will be next week on the 17th October. I am new to ROYTEC and there examination procedures and there are some processes that I have to go through. We will talk tomorrow in class about this. So we continue with class work in the morning - 9th October 2010
Assessment 1 Write an algorithm and the IPO before writing a program to solve the following problem: The program must request the name, subject and marks of five students and display them according to the grades based on a pre-defined grade scheme.
Assessment 2 Write an algorithm and the IPO before writing a program to solve the following problem: A bank pays interest based on the amount of money deposited. If the amount is less than $5,000, the interest is 4% per annum. If the amount is $5,000 or more but less than $10,000, the interest is 5% per annum. If the amount is $10,000 or more but less than $20,000, the interest is 6% per annum. If the amount is $20,000 or more, the interest is 7% per annum. The program must be submitted without any syntax and warning errors.
if(second_term >= 0) { //cout << "\nsecond_term is greater than or eaqual to 0: " << second_term << "\n"; output1(first_term, second_term); } // end if else { //cout << "\nsecond_term is less than or eaqual to 0: " << second_term << "\n"; output2(first_term, second_term); } // end else
} // end imaginaryRoots
// main function int main() { cout << "\n***********************************************************************\n"; cout << "* Find the roots of a quadratic equation in standard form. *"; cout << "\n***********************************************************************\n";
// declare variables a, b, and c double a, b, c; char n;
do { cout << "\nEnter the value of 'a': "; cin >> a; cout << "Enter the value of 'b': "; cin >> b; cout << "Enter the value of 'c': "; cin >> c;
double det = determinant(a, b, c);
if (det >= 0) { realRoots(a, b, sqrt(det)); // roots are real } // end if else { imaginaryRoots(a, b, sqrt(-det)); // roots are imaginary } // end else
cout << "\nWould you like to solve another?"; cout << "\nEnter 'y' for 'Yes' -- 'n' for 'No': "; cin >> n; cout << "\n";
} while (n == 'y' || n == 'Y'); // end do-while loop
#include main(){ char name1 [30]; int score; printf("Enter Name\t\n"); scanf("%d",&name1); printf("Enter Mark\t\n"); scanf("%d",&score); } Can some tell me what is wrong. when i run the program there is no option to enter the mark
Please find below the 3rd assignment which will be due on 7th October 2010.
Write a program to solve the following problem: The program must request the name, subject and five test scores of five (5) students for their course work in History for a school term from a file, “historyinput.txt”. Each test score is marked out of 10 marks. Compute the average mark and send the result to another file, “historyoutput.txt”, based on the following grade scheme shown below.
Mark Grade 90-100 A 80-89 B 70-79 C 60-69 D 50-59 E 0-49 F
Unfortunately I have to leave the country on 14th November and miss the class carded for that day. This means that we need to have a make-up class. The make-up class will be on Monday 8th November 2010 from 5 pm - 8 pm.
Just spoke to Mr. Warner and we do not have class today the room is not available. Therefore he would like to have class tomorrow (Tuesday 8th November,10 @5pm-8pm). Anyone with any objections please post.
only chapters 1-5 coming,and once u get all his assignments especially the last one,you will be fine. i tiring to get the string compare thing on page 108 so i could do his assignment. If anybody want to study together i'm game! nattynovember@gmail.com
HINTS FOR TEST: section1: 10 multiple choice (10 marks) section2: writing an IPO, algorithm, and program similar to assignment 2.(30 marks) you are given an algorithm and you have to state the output you are given a program and you have to state the output definitions:sentinel,syntax,n++,++n, n--,--n,n*=m
hey natalie if you lik we could study online add me to your contact lists. randybee@hotmail.com. let me through this blog when you have done so. i will be studing some programming from bout 1pm
Hi sir,i need another compiler, please
ReplyDeletePlease Help.
ReplyDeleteWhat's wrong with my program?
I'll be back Friday.
#include
main(){
int a,b,c ;// finding the sum of three numbers
int SUM=a+b+c;
int TOTAL;
printf("Welcome user:-)");
printf("\nplease enter 1st digit>>");
scanf("%n",a);
printf("\nplease enter 2nd digit>>");
scanf("%n",b);
printf("\nplease enter 3rd digit>>");
scanf("%n",c);
SUM=("%n+%n+%n",a,b,c);
printf("\nYour Answer Is %n",SUM);
1 of the problems is u forgot to end it with }
ReplyDeleteNo sir, i didn't copy it for the message, it was in the program:-)
ReplyDeletei used this online compiler
http://cmpe150-1.cmpe.boun.edu.tr/phpccompiler/login.php
#include
main(){
int a,b,c;// finding the sum of three numbers
int SUM=a+b+c;
int TOTAL;
printf("Welcome user:-)");
printf("\nplease enter 1st digit>>");
scanf("%n",a);
printf("\nplease enter 2nd digit>>");
scanf("%n",b);
printf("\nplease enter 3rd digit>>");
scanf("%n",c);
SUM=("%n+%n+%n",a,b,c);
printf("\nYour Answer Is %n",SUM);
getchar();
}
participa....:-)
ReplyDeleteU didn't put in stdio.h
ReplyDeleteafter #include.
Also try using dev c++ 4.9.9.2
Natalie try running your program from the command prompt. If you don't know how i will guide u through.I tried this in my compiler and didn't work but got the result in the command prompt.
ReplyDelete#include stdio.h
main(){
int a,b;
printf("enter first number:");
scanf("%d",&a);
printf("enter second number:");
scanf("%d", &b);
printf("%d + %d = %d\n",a,b,a+b);
getchar();
}
Result:50+50=100
Sir i am using dev-c++ and its working but not what i did in class.. example
ReplyDelete#include
int main ()
{
using namespace std;
cout << "Hey stephan.";
cout << endl;
cout << "Dont slap shannon!" <<endl;
system ("pause");
return 0;
}
This comment has been removed by a blog administrator.
ReplyDeleteis what am doing wrong
ReplyDeletehey stephan tying to run this in turbo c+ as well but jus cant seem to get it to work will try it from the command prompt.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeletestdio.h put iostream
ReplyDeletewhat command is cout??
ReplyDeletemiracle c is the best, dev++ dosent like me.
ReplyDeletefor the complier to output
ReplyDeletecan someone help me in finding a link to a compiler. hav try dev, tiny c and miracle c--dosnt work. i would prefer any one that works
ReplyDeletesir my compilers not working need gudiance
ReplyDeleteRandy send me ur email will send u the compiler from school. Curious to know whats happening with dev c?
ReplyDeletehi aneesa my email is randybee@hotmail.com
ReplyDeletemuch thanks
a complier please!!!!
ReplyDeleterandy did u get the compiler or u want me to email you the one we use in school?
ReplyDeleteaneesa can you send me dat one from school.how get it . i have been to get free version but keep hitting a wall
ReplyDeleteHey, i need help trying to make a program to solve quadratic equations, how would i enter the square reet part?
ReplyDelete// // This program finds the x cordinates of a quadratic equation
#include
main(){
float a,b,c,TOTAL1,TOTAL2,x1,x2;
printf("WELCOME TO QUADRATIC CALCULATOR:-)");
printf("\nPlease enter the value of a\n");
scanf("%f",&a);
printf("\nPlease enter the value of b\n");
scanf("%f",&b);
printf("\nPlease enter the value of c\n");
scanf("%f",&c);
TOTAL1= b*b-4*a*c;
printf("\nTOTAL1 IS %f\n",TOTAL1);
TOTAL2= TOTAL1*.5;
x1=(-b+TOTAL1)/2*a;
x2=(-b-TOTAL2)/2*a;
printf("\nYour answer is x1=%f\n",x1);
printf("\nYour answer is x2=%f\n",x2);
}
x = ( -b +/- sqrt(b - 4 a c) ) / (2 a).........i think this is how you enter it ......try it and see if it works.
ReplyDeleteRandy neither msn or yahoo allowing me to send the compiler cuz of its extension (exe.)......if u have any ideas on how to bypass this feel free to share......otherwise will bring on sunday.
ReplyDeleteHey class, Andy bro I will send it for you but I dont know if it will work
ReplyDeleteHi can anybody send me a complier ? Nothing I tried is working with my PC.
ReplyDeleteNatasha what compilers have you tried???
ReplyDeletehttp://punuptech.com/2010/04/turbo-cc-on-3264-bit-vistawindows-7xp/
ReplyDeletevisit this site for a step by step in: How to install and download Turbo C++ on a 64 or 32bit computer.
Hope it works.
@natalie you can't put %n in ur 1st program its suppose to be %d
ReplyDelete@natalie in ur second program u will need to use the maths library this is used to conduct math functions
ReplyDeletesir could u please e-mail me the course outline i never got one.
ReplyDeletealso can someone help me get a compiler please it would be greatly appreciated
ReplyDeleteyou can look on the school server you will get the software for turbo C++
ReplyDeleteAnyone needs help with their class assignment? feel free to ask.
ReplyDeleteI know it's not finished but after i type in the hours worked the programme cuts off:
ReplyDelete# include
main()
{
double hrs,rate,reg,tax,gross,ot;
char name[24];
printf("enter name: \t");
scanf("%s",&name);
printf("hrs worked: \t");
scanf("%4.2lf",&hrs);
printf("rate of pay: \t");
scanf("%4.2lf",&rate);
if (hrs<=40){
reg = hrs * rate;
ot=(hrs-40)*rate*1.5; }
getchar();
Hello All
ReplyDeleteThe mid-term examination will be next week on the 17th October. I am new to ROYTEC and there examination procedures and there are some processes that I have to go through. We will talk tomorrow in class about this. So we continue with class work in the morning - 9th October 2010
Assessment 1
ReplyDeleteWrite an algorithm and the IPO before writing a program to solve the following problem:
The program must request the name, subject and marks of five students and display them according to the grades based on a pre-defined grade scheme.
Assessment 2
Write an algorithm and the IPO before writing a program to solve the following problem:
A bank pays interest based on the amount of money deposited. If the amount is less than $5,000, the interest is 4% per annum. If the amount is $5,000 or more but less than $10,000, the interest is 5% per annum. If the amount is $10,000 or more but less than $20,000, the interest is 6% per annum. If the amount is $20,000 or more, the interest is 7% per annum.
The program must be submitted without any syntax and warning errors.
Hi Sir thanks for not emailing the blog for me Nicole Spring
ReplyDelete// code for quadratic equations
ReplyDelete#include
#include
#include
// function to evaluate the determinant
double determinant(double arg_a, double arg_b, double arg_c) {
return (arg_b * arg_b) - (4 * arg_a * arg_c);
} // end determinant
// function to evaluate real roots
void realRoots(double arg_a, double arg_b, double arg_sqrt) {
double firstRoot = (-arg_b/(2 * arg_a)) +
(arg_sqrt/(2 * arg_a));
double secondRoot = (-arg_b/(2 * arg_a)) -
(arg_sqrt/(2 * arg_a));
cout << "\nFirst Real Root: \t" << firstRoot << "\n";
cout << "Second Real Root: \t" << secondRoot << "\n";
} // end realRoots
void output1(double first, double second) {
cout << "\nFirst Imaginary Root: \t" << first << " + " << second << "i" << "\n";
cout << "\nSecond Imaginary Root: \t" << first << " - " << second << "i" << "\n";
} // end output1()
void output2(double first, double second) {
second = -(second); // change the sign of the second term, for correct output
cout << "\nFirst Imaginary Root: \t" << first << " - " << second << "i" << "\n";
cout << "\nSecond Imaginary Root: \t" << first << " + " << second << "i" << "\n";
} // end output2()
// evaluate imaginary roots
void imaginaryRoots(double arg_a, double arg_b, double arg_imag_sqrt) {
double two_a = 2 * arg_a;
double first_term = (-arg_b)/two_a;
double second_term = (arg_imag_sqrt)/two_a;
if(second_term >= 0) {
//cout << "\nsecond_term is greater than or eaqual to 0: " << second_term << "\n";
output1(first_term, second_term);
} // end if
else {
//cout << "\nsecond_term is less than or eaqual to 0: " << second_term << "\n";
output2(first_term, second_term);
} // end else
} // end imaginaryRoots
// main function
int main()
{
cout << "\n***********************************************************************\n";
cout << "* Find the roots of a quadratic equation in standard form. *";
cout << "\n***********************************************************************\n";
// declare variables a, b, and c
double a, b, c;
char n;
do {
cout << "\nEnter the value of 'a': ";
cin >> a;
cout << "Enter the value of 'b': ";
cin >> b;
cout << "Enter the value of 'c': ";
cin >> c;
double det = determinant(a, b, c);
if (det >= 0) {
realRoots(a, b, sqrt(det)); // roots are real
} // end if
else {
imaginaryRoots(a, b, sqrt(-det)); // roots are imaginary
} // end else
cout << "\nWould you like to solve another?";
cout << "\nEnter 'y' for 'Yes' -- 'n' for 'No': ";
cin >> n;
cout << "\n";
} while (n == 'y' || n == 'Y'); // end do-while loop
return 0;
}
hi sir can i get my 10% now, it was a task 4 me to get through this blog :)
ReplyDeletevoid main(){
ReplyDeleteint hours ,rate,regPay,ovtPay,grosPay,netPay,tax;
char name[16];
printf("PLease enter employee name:\t");
scanf("%s",&name);
printf("\nHours worked\t");
scanf("%d",&hours);
printf("\nRate of Pay?\t");
scanf("%d",&rate);
if (hours <=40){
regPay= hours * rate ;
ovtPay =0;
}
else{
regPay= 40* rate;
ovtPay=(hours - 40)* rate*1.5;
}
grosPay = regPay + ovtPay;
netPay= (hours*rate );
tax= grosPay -0.08;
printf(" \n*ALL INFORMATION ENTERED!*\n");
printf("\nName of employee %s",name);
printf("\nGross pay:$%d\n",grosPay);
printf("\nTax deducted :$%d\n",tax);
printf("\nNet Pay : $ %d\n",netPay);
}
hey wasn't in class today what were the topics discussed and when is the 1st assignment due sir
ReplyDelete#include
ReplyDeletemain(){
char name1 [30];
int score;
printf("Enter Name\t\n");
scanf("%d",&name1);
printf("Enter Mark\t\n");
scanf("%d",&score);
}
Can some tell me what is wrong. when i run the program there is no option to enter the mark
sir, still awaiting your answer from last class concerning the exam
ReplyDeleterandy this is what i did
ReplyDelete#include
main()
{
double s1,s2,s3,m1,final;
printf("Term Test Marks\n");
printf("\nFirst Mark: ");
scanf("%lf",&s1);
printf("Second Mark: ");
scanf("%lf",&s2);
printf("Third Mark: ");
scanf("%lf",&s3);
printf("\nEnd Of Term\n");
printf("\nMark: ");
scanf("%lf",&m1);
final=((s1+s2+s3)/75*50)+ m1/100*50;
printf("Final Score: %.0lf\n",final);
if(final>=50){printf("Student Pass\n");}
else{(printf("Fail\n"));
}
}
anessa. but why u using the sum of three marks,the ques ask for the marks of five different students and corres grade.But i still like the program
ReplyDeleteLol sry randy i gave u d wrong program. still working on that one.
ReplyDeleteMust Say dev C is the worst nof of my programes work with it
ReplyDeletei gave up on thst dev c long time. use the turbo c copy u email to me. it working on my pc-- using old school OS though XP not the fancy one you got.
ReplyDeleteany word on mid term . is it confirm for this sunday 17. or not? Sir please let us know!!
ReplyDeletehaving trouble with my if/else statements, and have no idea what i'm doing wrong
ReplyDeletePlease find below the 3rd assignment which will be due on 7th October 2010.
ReplyDeleteWrite a program to solve the following problem:
The program must request the name, subject and five test scores of five (5) students for their course work in History for a school term from a file, “historyinput.txt”. Each test score is marked out of 10 marks. Compute the average mark and send the result to another file, “historyoutput.txt”, based on the following grade scheme shown below.
Mark Grade
90-100 A
80-89 B
70-79 C
60-69 D
50-59 E
0-49 F
Hello All
ReplyDeleteUnfortunately I have to leave the country on 14th November and miss the class carded for that day. This means that we need to have a make-up class. The make-up class will be on Monday 8th November 2010 from 5 pm - 8 pm.
I have another class on 8 november at said time
ReplyDeletesorry sir but i can't attend the makeup class on the 8th.i'm from san fernando and i will have trouble for transport that late at night
ReplyDeletePlease come to class and we will see how this can work out for everyone.
ReplyDeleteJust spoke to Mr. Warner and we do not have class today the room is not available. Therefore he would like to have class tomorrow (Tuesday 8th November,10 @5pm-8pm). Anyone with any objections please post.
ReplyDeleteI have a class at that time so i would not be able to make it
ReplyDeletedoes anyone have sir's email address?? plz post
ReplyDeletethis is sir email:stewenchic@yahoo.com
ReplyDeletethank you mr.kingpin
ReplyDeletehttp://www.cprogramming.com/how_to_learn_to_program.html
ReplyDeletehave sir given any pointers on what might come for finally.has anyone given in all their assigments, i still working on the last one.
ReplyDeleteonly chapters 1-5 coming,and once u get all his assignments especially the last one,you will be fine. i tiring to get the string compare thing on page 108 so i could do his assignment. If anybody want to study together i'm game!
ReplyDeletenattynovember@gmail.com
thanks very much natalie. still trying to finish the last assig. good luck
ReplyDeleteHINTS FOR TEST:
ReplyDeletesection1:
10 multiple choice (10 marks)
section2:
writing an IPO, algorithm, and program similar to assignment 2.(30 marks)
you are given an algorithm and you have to state the output
you are given a program and you have to state the output
definitions:sentinel,syntax,n++,++n, n--,--n,n*=m
Programming Rules:-)
ReplyDeletethanks nikk and natalie for the hints. hope we all past
ReplyDeleteWould anyone like to form a group just for an hour or two for revision? during the week,i know you have other exams buh please...
ReplyDeletehey natalie if you lik we could study online add me to your contact lists. randybee@hotmail.com. let me through this blog when you have done so. i will be studing some programming from bout 1pm
ReplyDeleteanyone knows if sir is back yet, and did he give out our marks yet..
ReplyDelete