ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1567. SMS-spam

in my compilator 6.00 it's working, but here compilation eror
Posted by Arman 25 Sep 2011 15:25
Erors

e36db86e-c920-436d-9c9f-28542887e568
e36db86e-c920-436d-9c9f-28542887e568(14) : warning C4996: 'getch': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _getch. See online help for details.
        S:\checker\compile\vc10\include\conio.h(128) : see declaration of 'getch'
t:\temp\e36db86e-c920-436d-9c9f-28542887e568(12) : warning C4700: uninitialized local variable 'buf' used
e36db86e-c920-436d-9c9f-28542887e568.obj : error LNK2019: unresolved external symbol _getch referenced in function _main
e36db86e-c920-436d-9c9f-28542887e568.exe : fatal error LNK1120: 1 unresolved externals

Working Code


#include <iostream>
#include <conio.h>
using namespace std;

int main()
{
    int j=0;
    int k=0;
    int buf;
    for(int i=0; buf!=13; i++)
    {
        buf=getch();
        if( buf=='a' || buf=='d' || buf=='g' || buf=='j' || buf=='m' || buf=='p' || buf=='s' || buf=='v' ||  buf=='y' || buf=='.' || buf==32)
            j++;
        if( buf=='b' || buf=='e' || buf=='h' || buf=='k' || buf=='n' || buf=='q' || buf=='t' || buf=='w' ||  buf=='z' || buf==',')
            j=j+2;
        if( buf=='c' || buf=='f' || buf=='i' || buf=='l' || buf=='o' || buf=='r' || buf=='u' || buf=='x' || buf=='!')
            j=j+3;
    }
    cout<<j<<endl;

    return 0;
}

Why eror?
Re: in my compilator 6.00 it's working, but here compilation eror
Posted by Vladimir Yakovlev (USU) 25 Sep 2011 20:15
We have no conio.h
Use getchar() instead of getch()