collapse collapse

* Who's Online

  • Dot Guests: 77
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11163
  • stats Total Topics: 1699
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 248

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - rm9402

Pages: [1]
1
Technology / The Tunnel
« on: May 21, 2011, 01:51:18 pm »
    Hey guys(and girls) I just figured I should share this with you: thetunnelmovie.net besides looking like a good movie it actually uses p2p/piracy to spread the word about the movie and even the movie itself! So go have a look at it if you want.

2
C / from capitalized to lower case and vice versa.
« on: December 23, 2010, 08:53:25 pm »
Hey i'm here with another post about characters xD knowing that this function below changes a capital ascii letter to lower case. Could I somehow make it read whole arrays? I'm thinking that you would have to use a loop to go through every character in the array. I was just wondering if this is in the right direction or not. Thanks for the help in advance!
Code: C
  1. int lower(int c){
  2.  
  3.         if(c>='A' && c <= 'Z'){
  4.                 return c + 'a' -'A';
  5.         }
  6.  
  7.         else{
  8.                 return c;
  9.         }
  10. }

3
C / reversing a character string
« on: December 21, 2010, 07:10:21 pm »
Okay I am encountering another problem. I'm supposed to write a program that reverses a character string but i'm having trouble doing so. The book (k&r C) wants you to modify this code to make it reverse a string and print it.

Code: C
  1. #include <stdio.h>
  2. #define MAXLINE 1000
  3.  
  4. int getl(char s[], int lim);
  5. void copy(char to[], char from[]);
  6.  
  7. int main(){
  8.        
  9.         char line[MAXLINE];
  10.         int len;
  11.         int max;
  12.         char longest[MAXLINE];
  13.        
  14.         max = 0;
  15.         while((len = getl(line, MAXLINE)) > 0){
  16.                 if(len>max){
  17.                         max = len;
  18.                         copy(longest, line);
  19.                 }
  20.         }
  21.         if(max>0){
  22.                 printf("%s", longest);
  23.         }
  24.         printf("\n");
  25.         return 0;
  26. }
  27.  
  28. int getl(char s[], int lim){
  29.  
  30.         int c, i;
  31.        
  32.         for(i=0; i<lim-1 && (c=getchar())!=EOF && c!='\n';++i){
  33.                 s[ i ] = c;
  34.         }
  35.         if(c=='\n'){
  36.                 s[ i ]==c;     
  37.                 ++i;
  38.         }
  39.  
  40.         s[ i ] = '\0';
  41.         return i;
  42. }
  43.  
  44. void copy(char to[], char from[]){
  45.        
  46.         int i;
  47.        
  48.         i=0;
  49.         while((to[ i ] = from[ i ])!= '\0'){
  50.                 ++i;
  51.         }
  52. }
  53.  

4
C / help with C counting program
« on: November 17, 2010, 06:14:48 am »
    Hey guys I am reading "The C Programming Language (Second Edition)" and I have been following their programs up untill now were it seems to have me confused. What the program does (is supposed to do) is count all the times each digit of white space characters ('\t's, '\n's, and blank spaces). However when I run the program it seems to just not do anything like almost as if it is just taking in getchar() and not outputting anyting. here's the code
Code: C
  1. #include <stdio.h>
  2.  
  3. /* count digits, white space, others */
  4.  
  5. int main(){
  6.  
  7.         int c, i, nwhite, nother;
  8.         int ndigit[10];
  9.  
  10.         nwhite = nother =  0;
  11.         for(i = 0; i<10; i++){
  12.                 ndigit[i] = 0;
  13.         }
  14.  
  15.         while((c = getchar()) != EOF){
  16.                 if(c >= '0' && c <= '9'){
  17.                         ++ndigit[c-'0'];
  18.                 }
  19.  
  20.                 else if(c == ' ' || c == '\n' || c == '\t'){
  21.                         ++nother;
  22.                 }
  23.  
  24.         }
  25.  
  26.         printf("digits = ");
  27.         for(i = 0; i < 10; ++i){
  28.                 printf("%d", ndigit[i]);
  29.         }
  30.  
  31.         printf(", white space = %d, other = %d\n", nwhite, nother);
  32.         return 0;
  33. }
  34.  

5
General Talk / hey guys!
« on: May 10, 2010, 07:05:44 pm »
Hello again its me and it has been quit some time since i have made a post or even been to this site in a while. Well now that all of the end of the year test are over and now i got a lot of mess out of the way im coming back. I hope to be spending much more time on this site and as well as understanding and finishing a C++ book i started reading. Well im glad to be back!  ;D

6
Suggestions / CALCULATOR --- an awsome one at that :)
« on: March 08, 2010, 08:33:21 pm »
Ok...so i have an idea (dont know if this is the right place to post it but w/e) I was thinking about making a calculator in c++. well this calculator is gonna be normal in all ways except... if you divide by zero. So if u divide by zero on this calculator your computer will shut down or if u divide by zero it could format your hard drive or it could just delete random files every time by zero   8)  ! Ok if you have any suggestions plz post em  ;D

7
C++ / help on hello world program (the frame around the characters)
« on: March 05, 2010, 10:34:26 pm »
Hey guys i know i havent been on in a while. I havent been on lately because of school and other stuff..........
 ;D well anyways i am working with c++ by reading through the book Accelerated C++ by Andrew Koeing and Barbara E. Moo and i came across a problem that they get you to work out at the end of the chapter. The question/challenge was to change the frame around a hello world program. Like to change the spaces between each side and the top and bottom.

Code: C++
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8.   cout<<"what is your name: \n";
  9.   string name;
  10.   cin>>name;
  11.   string greeting = "hello " +name+ " !";
  12.   int top_pad=1; //1 space from the greeting to the top part of the frame
  13.   int side_pad=2;// space from one side to the beggining of the greeting to the end of the greeting to the other side
  14.   const int rows= top_pad *2 + 3;
  15.   const int cols = greeting.size() + ( side_pad *2 +2); //how many colums there are in the frame
  16.   cout<< endl;
  17.  
  18.   for(int r = 0; r != rows; r++) {
  19.          
  20.           string::size_type c = 0;
  21.           while( c != cols) {
  22.                  //to see were you are at to print the greeting
  23.                  if(r== top_pad + 1 && c==side_pad +1) {
  24.                                cout<< greeting;
  25.                                c += greeting.size();
  26.                                }else{
  27.                                      if( r == 0 || r== rows -1 ||      //to know if you are on the far left or far right colum to print an asterisk to the frame
  28.                                          c == 0 || c== cols -1) {
  29.                                               cout<< "*";
  30.                                              
  31.                                }else{
  32.                                     cout<<" "; //you arent righting the greeting and you arent at the end of the colum so put a space
  33.                                     c++;
  34.                                     }
  35.                                     }
  36.                                  
  37. }
  38. }
  39.    system("pause");
  40.    return 0;
  41. }
  42.  
  43.                            
  44.  
  45.    
  46.  

Cansomebody help me find out why it keeps going into an infinite loop??

8
C++ / umm simple beep program lol
« on: August 30, 2009, 04:25:46 pm »
here is my simple but stupid no lifeing beep program that is about to get torn to shreads by Celestialkey haha jk ;D ;D
Code: [Select]
#include "stdafx.h"
#include <iostream>
#include <windows.h>

using namespace std;

int speed1() {
int choice;
for(choice=0;choice < 10;choice++) {
cout<<"BEEP";
Sleep (1000);
Beep (1000,100);
}
return 0;
}
int speed2() {
int choice;
for(choice=0;choice < 10;choice++) {
cout<<"BEEP";
Sleep (100);
Beep (1000,100);
}
return 0;
}
int speed3 () {
int choice;
for(choice=0;choice < 10;choice++) {
cout<<"BEEP";
Sleep(10);
Beep (1000,100);
}
return 0;
}

int main () {
int choice;
cout<<"press 1 for slow Beep speed: \n";
cout<<"press 2 for medium Beep speed: \n";
cout<<"press 3 for fast Beep speed: \n";
cin>>choice;
while (true) {
if (choice==1) {
speed1 ();
}
if (choice==2) {
speed2 ();
}
if (choice==3) {
speed3 ();
}
}
char f;
cin>>f;
return 0;
}

9
C++ / ....help with this code
« on: August 08, 2009, 04:46:56 pm »
ah i need help. trying to make a calculator yes i no it will be one shot since im just begining.
Code: [Select]
using namespace std;
int add () {

int a;
int b;
cout<<"what do you want to add: \n";
cin>>a;
cin>>b;
cout<<"your answer is:  \n"<<a+b;
char f;
cin>>f;
return 0;
}
int subtract () {
int a;
int b;
cout<<"what do you want to subtract: \n";
cin>>a;
cin>>b;
cout<<"your answer is: \n"<<a-b;
char f;
cin>>f;
return 0;
}
int multiply () {
int a;
int b;
cout<<"what do you want to multiply: \n";
cin>>a;
cin>>b;
cout<<"your answer is: \n"<<a*b;
char f;
cin>>f;
return 0;
}
int divide () {
int a;
int b;
cout<<"what do you want to multiply: \n";
cin>>a;
cin>>b;
cout<<"your answer is: \n"<<a/b;
char f;
cin>>f;
return 0;
}
int main () {
int a;
a=add ();
int b;
b=subtract ();
int c;
c=multiply ();
int d;
d=divide ();

cout<<"what would you like to do?"<<endl;
cout<<"press a for addition...."<<endl;
cout<<"press b for subtraction..."<<endl;
cout<<"press c for multiplication..."<<endl;
cout<<"press d for division...."<<endl;
cin>>a;
cin>>b;
cin>>c;
cin>>d;
if (a==add()){
cout<<add ();
}
if (b==subtract ()) {
cout<<subtract ();
}
if (c==multiply ()) {
cout<<multiply () ;
}
if (d==divide ()) {
cout<<divide () ;
}
char f;
cin>>f;
return 0;
}

10
C++ / ah i need help on this code in c++
« on: August 06, 2009, 12:00:30 pm »
Code: [Select]
#include "stdafx.h"
#include <iostream>
using namespace std;
int main() {
int password = 12345;
int attempt;
cout<<"welcome to the matrix \n" ;
cout<<"enter password here: "<<endl;
if (attempt==password){
while (true);
cout<<"welcome to the matrix";
else cout<<"ahhhh bye";
}
system ("pause");

Pages: [1]

Donate


* Search


* Recent Posts

Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]


Re: Client-Server Messaging by Nathan
[October 25, 2015, 05:48:57 pm]