-
Content count
66 -
Joined
-
Last visited
Community Reputation
3 NeutralAbout justsum13lse

-
Rank
Advanced Member
Profile Information
-
Gender
Male
-
Location
Eastern U.S.
-
Interests
Anything not my job.
Recent Profile Visitors
1,143 profile views
-
elementevil would be great. If it matters I got a VIP account, but they seem to know what they are doing over there. They crack a phone game and charge out the ass for the mod.
-
justsum13lse changed their profile photo
-
I just want to use this to make all the other pokemon players at work feel inferior. They are obsessed.
-
I don't understand why people don't just use kodi. That is the best for watching everything and its 100% free.
-
That works great. But I didn't explain well what I was trying to achieve. I was in the middle of studying and trying to figure it out with someone else in class. The goal of the project was to create a structure that asks for the first and last name, the student ID, and 3 test scores. The user can enter up to 10 names, or can end it at anytime when the user types in zz or ZZ. When the user types in zz or ZZ, the program should display everything you have entered up until that point. So if I had entered 3 names up until the point I entered ZZ, it would display John Smith 50.0 F Jerry Garcia 80.0 B Jane Doe 95.5 A I didn't know that the strcmp could be used in the fashion that you used it in. That really helped. I wasn't clear enough in explaining how my teacher wants the program to work. I was busy while I was asking for help on this board. But I almost have the program working correctly. Just a problem with the scanf that involves 2 strings I mention below. I also get bonus points if I can make the names display in alphabetical order. I am working on that. I tried a if(strcmp(s[a].l_name, s[a+1].l_name) < 0) s[a].temp = s[a].l_name; s[a].l_name = s[a+1].l_name; s[a+1].l_name = s[a].temp; haven't quite got it working yet. And I used some of your code, it was kind of what I was looking for. I used your if(strcmp(s[a].f_name, "ZZ") == 0) to break; else continue. But now I have a problem. On the line where it asks for first and last name by doing scanf("%s %s", &s[a].f_name, &s[a].l_name) if(strcmp(s[a].f_name, "ZZ") == 0) break; else { all the other stuff } but because of the scanf("%s %s"), it doesn't immediately break when the user hits enter. It waits for the seconds string to be entered. Once the second string is input by the user, it breaks and works exactly how I want it to. But I need it to break immediately when the user enters ZZ. I know I could do a scanf("%s", &s[a].f_name); if(strcmp(s[a].f_name, "ZZ") == 0) break; else scanf("%s", &s[a].l_name); instead of scanf("%s %s", &s[a].f_name, &s[a].l_name) if(strcmp(s[a].f_name, "ZZ") == 0) break; but according to the way I believe the teacher wants it, she wants to enter both names on the same line. This is what I have so far. This version works exactly the way I want it to, except for the waiting on the second string to be entered in the scanf I mentioned above. And also, it doesn't arrange the last names in alphabetical order yet. #include <stdio.h> #include <string.h> #include <stdlib.h> struct student{ char f_name[20]; char l_name[20]; char temp[20]; int id_num; float test1; float test2; float test3; }s[10]; int main(void) { char ch, grade; char temp; float average; int kids; int a; for(a=0;a<10;a++) { printf("Enter first name(ZZ to quit): "); scanf("%s %s", &s[a].f_name, &s[a].l_name); if(strcmp(s[a].f_name, "ZZ") == 0) break; else { printf("Enter student ID number: "); scanf("%d", &s[a].id_num); printf("Enter the 3 test scores: "); scanf("%f %f %f", &s[a].test1, &s[a].test2, &s[a].test3); } } a--; printf("Student\t\tStudent ID\tFinal Grade\n"); for(a;a>=0;a--) { average = (s[a].test1 + s[a].test2 + s[a].test3) / 3; if(average>= 90) grade = 'A'; else if(average>= 80 && average <90) grade = 'B'; else if(average>= 70 && average< 80) grade = 'C'; else if(average >= 60 && average<70) grade = 'D'; else grade = 'F'; printf("%s, %s\t%d\t\t%.2f \t%c\n", s[a].l_name, s[a].f_name, s[a].id_num, average, grade); } return 0; }
-
Changed my i variable to a to hopefully avoid the italics that are created when I use an array of i. #include <stdio.h> #include <string.h> struct student{ char f_name[20]; char l_name[20]; int id_num; float test1; float test2; float test3; }s[10]; int main(void) { char ch; float average; int a; for(a=0;a<=1;a++) { printf("Enter first name(ZZ to quit): "); scanf("%s", &s[a].f_name); ch = s[a].f_name; if(ch== 'zz') break; else{ printf("Enter last name: "); scanf("%s", &s[a].l_name); printf("Enter student ID number: "); scanf("%d", &s[a].id_num); printf("Enter the 3 test scores: "); scanf("%f %f %f", &s[a].test1, &s[a].test2, &s[a].test3); } } a--; printf("Student\t\tStudent ID\tFinal Grade\n"); for(a;a>=0;a--) { average = (s[a].test1 + s[a].test2 + s[a].test3) / 3; printf("%s, %s\t%d\t\t%.2f\n", s[a].l_name, s[a].f_name, s[a].id_num, average); } return 0; }
-
justsum13lse started following Structures homework
-
Ok, most of this code works. I am just trying to make an exit procedure if they put in ZZ or zz for the first name. I have tried a few different ways #include <stdio.h> #include <string.h> struct student{ char f_name[20]; char l_name[20]; int id_num; float test1; float test2; float test3; }s[10]; int main(void) { char ch; float average; int i; for(i=0;i<=1;i++) { printf("Enter first name(ZZ to quit): "); scanf("%s", &s.f_name); ch = s.f_name; if(ch== 'zz') break; else{ printf("Enter last name: "); scanf("%s", &s.l_name); printf("Enter student ID number: "); scanf("%d", &s.id_num); printf("Enter the 3 test scores: "); scanf("%f %f %f", &s.test1, &s.test2, &s.test3); } } i--; printf("Student\t\tStudent ID\tFinal Grade\n"); for(i;i>=0;i--) { average = (s.test1 + s.test2 + s.test3) / 3; printf("%s, %s\t%d\t\t%.2f\n", s.l_name, s.f_name, s.id_num, average); } return 0; } Everything works properly except the ZZ to quit. If anyone could throw some help I would appreciate it, as always. Thanks
-
We haven't really messed with strings yet. Everything I have done with strings I have learned on my own. stdin, i have watched a video that had that in it. I know it stands for standard input. But I haven't used fgets at all. What exactly does fgets do? How does it differ from gets? I know fgets(<variable name>, <Value?>, <stdin? Have no idea>; Not sure what that line does. I understand the for(i = strlen(str), but I didn't know you could do it like that. Why is the "i >= ;"? I take it there was a 0 there and it didn't get printed on the message. But if you could explain the fgets to me, that would be helpful. I get the for loop. Does the array/string <code> str [ i ] </code> recognize the last character in the array as a /n, or press of the enter button? Is that recorded from the user input? Also, how do you enter code like you did above on this site? Some sites do it with <code></code>, but apparently this one doesnt. Thanks for the help. I kind of gets this. Nevermind on the fgets(variable, amount, stdin) I watched a video and see that stdin is the keyboard. But it records the last entry in the array as a \n?
-
I am attempting to make a program that rewrites a sentence backwards. It is freezing up at the beginning of the for loop. I am not sure if I am properly entering the array, or if the str[N] is even being recorded as an arrays through the gets function at the top. Any help is appreciated. It is recording my str of i array as italics. It is all supposed to be str[of i] but i changed it to j in the places it kept making it italics. just pretend all the str[arrays] are str [ of i]. #include <stdio.h> #include <string.h> #define N 35 int main(void) { char str[N]; int i, j, temp; int length; printf("Enter a sentence up to %d characters long.\n", N); gets(str); printf("The sentence entered is: \n"); puts(str); //Check to see if it is recording string. length = strlen(str); printf("%d", length);//Check to make sure it is recording the proper length for(i=0;i<length-1;i++)//Not sure if this is right. I tried "for(i=length;i>=0;i--) and it froze up. { do { //Not sure if strings and arrays are mixed, if if str is being recorded as an array above. temp = str[j]; //Beginning at the for statement to the end of its loop is where I need help. str[j] = str[i+length-1]; str[i+length-1] = temp; } } while{(str[i+length-1] !=str[j])} printf("%s", str); return 0; }
-
And I am trying to figure out why this is returning me a value of 0. #include <stdio.h> int main(void) { int i; float total[5]={0}; float average; int score[5]; for(i=0;i<5;i++) { printf("enter a score: "); scanf("%d", &score); } for(i=0;i<5;i++) { total=total+score; } printf("Total = %d", total); return 0; }
-
I am pretty new to programming. I am taking my first CS class at college. I am having trouble understanding arrays. I am having trouble envisioning them. I have looked on the internet and can't really find anything that will help me. I am having trouble understanding the concept of creating something like array[ j ] I am making something like int main(void) { int array[5]; int i, j; for(i=0;i<5;i++) { printf("Row %d: ", i+1); for(j=0;j<5;j++) /* I understand that this lets me enter 5 numbers */ { scanf("%d", &array[ j ]); /* Does this now mean that the array will be populated by j? */ } } Part of my homework is to make a 2 dimensional array that adds the rows and the columns. I subscribe to chegg and have the answer below, but I am having a really hard time envisioning it and understanding it. The rowsum = rowsum+array[j] and colsum=colsum[j]+array[j]. Above I am just trying to make a program that just add the rows up. I understand the first for(i=0;i<5;i++) lets me enter 5 rows. The for(j=0;j<5;j++) lets me enter 5 numbers in each row. then the scanf("%d", &array[ j ]) populates the variable array with numbers from the variable j? Below I think I understand it to the point of the for(i=0;i<5;rowsum=colsum=0,i++). I assume that line means while i =0, and i < 5, rowsum of i equals colsum of i which is equal to 0, i++. But I don't really understand that last part. and I don't understand why they have the 2 following for statements after that line, or how the rowsum and colsum lines following those for statements work. I don't understand how it is adding the individual numbers up. I am having trouble with 1 dimensional arrays let alone 2 dimensional arrays. If anyone can help me or direct me to a decent website that goes in depth into arrays, I would greatly appreciate it. Thanks. #include <stdio.h> int main(void) { int i, j, array[5][5], rowsum[5],colsum[5]; for(i=0;i<5;i++) { printf("Enter row %d: ", i+1); for(j=0;j<5;j++) scanf("%d", &array[ i ][ j ]); } for(i=0;i<5;rowsum=colsum=0,i++); for(i=0;i<5;i++) for(j=0;j<5;j++) { rowsum[ i ]=rowsum[ i ]+array[ i ][ j ]; colsum[ j ]=colsum[ j ]+array[ i ][ j ]; } printf("\nRow Totals: "); for(i=0;i<5;i++) printf("%d\t", rowsum); printf("\nColumn Totals: "); for(i=0;i<5;i++) printf("%d\t", colsum); printf("\n"); return 0; }
-
Caprica - Only 1 Season before it got cancelled =|
-
I was curious if the bot being mentioned was under as much of an attack as honorbuddy was. Relatively constant banwaves. Whether it was, like honorbuddy, a pretty much guaranteed ban.
-
I used some bot to play archeage. Wasnt bossland's bot. I can't remember what it was called, but I signed up for the 3 day trial. I ran that thing for like 3 days straight. It ran pretty good for the most part. I was expecting to get banned. I had never played the game before. I was surprised I didn't get banned running it for like 20 hours a day on a brand new account. It even did some stupid stuff like jumping on something over and over when it got stuck, for hours. Never got banned. But I had a hard time getting into archeage and never played it afterwards.
-
Crazy. Blizzard is corporately strong-arming the guy. Was that particular bot getting caught as much as Honor Buddy has been lately? If so, I was thinking it gave them a reason to discontinue the product and save reputation all at the same time.